Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4206059

XOR-mode drawing doesn't work within a JWindow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      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)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            gstone Greg Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: