JDK-4206059 : XOR-mode drawing doesn't work within a JWindow
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-01-26
  • Updated: 2000-03-23
  • Resolved: 2000-03-23
Related Reports
Duplicate :  
Description

Name: gsC80088			Date: 01/26/99


At first, I noticed that when I had a JTextArea
inside a JInternalFrame inside a desktop inside a
JWindow, the caret wasn't flashing.  I could type
text fine, but no caret.  When I put everything
inside a JFrame instead, the caret displayed
properly.

The reason I think the problem is with XOR-mode
drawing is that I had written a console bean that
handles its own cursor, via XOR-mode drawing,
and I had the same problem: no caret display
unless everything resided inside a JFrame instead
of a JWindow.

Here's code to demonstrate:
(Try typing in the text area)

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class NoCaretDemo implements Runnable {
    public static void main(String[] args) {
        new Thread(new NoCaretDemo()).start();
    }

    public void run() {
        JWindow window = new JWindow();
        window.setSize(window.getToolkit().getScreenSize());
        window.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent evt) {
                    evt.getWindow().dispose();
                    System.exit(0);
                }
            });
        JDesktopPane desktop = new JDesktopPane();
        window.getContentPane().add(desktop);
        window.show();

        JInternalFrame frame = new JInternalFrame("Text Area", true, true, true, true);
        frame.getContentPane().add(new JTextArea(5, 10), BorderLayout.CENTER);
        frame.pack();

        desktop.add(frame, JDesktopPane.DEFAULT_LAYER);
    }
}
(Review ID: 47701)
======================================================================

Comments
WORK AROUND Name: gsC80088 Date: 01/26/99 Use a JFrame as the root instead of a JWindow. ======================================================================
11-06-2004

EVALUATION This may be related to 4204551 and does not look like a 2D issue, because the code works with JWindow and not with JFrame. Forwarding to Swing for investigation together with 4204551. thanh.nguyen@Eng 1999-01-27 I believe this is likely a focus issue and it looks to be a duplicate of 4254005. amy.fowler@Eng 2000-03-23
27-01-1999