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

JTextArea caret becomes invisible; text becomes unselectable

    XMLWordPrintable

Details

    • merlin
    • generic
    • generic

    Description



      Name: jk109818 Date: 06/14/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      In a JFrame, within a JDesktopPane, having 2 JInternalFrames with JTextAreas and
      switching from one internal frame to the other results in the disappearance of
      the caret and the loss of the ability to select text. You can still enter text.

      The test code follows. Strangely enough, the caret reappers if you take the
      entire JFrame out of focus and back, or if you pull down the menu.

      I was unable to trace any property changes that might be doing this.

      ====== InvisibleCaretTest ======
      import java.awt.*;
      import javax.swing.*;

      public class InvisibleCaretTest extends JFrame {
          public static void main(String[] args) {
              new InvisibleCaretTest();
          }

          public InvisibleCaretTest() {
              super("Invibisl Caret Test");
              JDesktopPane desk = new JDesktopPane();
              Container pane = getContentPane();
              pane.add(desk);

              JMenuBar menubar = new JMenuBar();
              setJMenuBar(menubar);
              JMenu testMenu = new JMenu("Test Menu");
              JMenuItem item = new JMenuItem("No action item");
              testMenu.add(item);
              menubar.add(testMenu);

              JInternalFrame if1 = createInternalFrame("Frame 1");
              JInternalFrame if2 = createInternalFrame("Frame 2");
              if2.setLocation(50, 50);
              desk.add(if1);
              desk.add(if2);
              if1.setVisible(true);
              if2.setVisible(true);

              setSize(500, 400);
              setVisible(true);
          }

          private JInternalFrame createInternalFrame(String title) {
              JTextArea ta = new JTextArea("The JTextArea for " + title);
              JInternalFrame f = new JInternalFrame(title);
              f.getContentPane().add(ta);
              f.setSize(200, 150);
              return f;
          }
      }
      (Review ID: 105405)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              tprinzing Tim Prinzing
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: