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

Caret hidden in JTextArea inside JInternalFrame

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 1.3.0_02
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None

      Description

      The attached program shows an JInternalFrame with a JTextArea in it. If you
      compile this with JDK 1.3.1_02 (1.3.1_02-b02), you will see that there is no caret in the JTextArea. You can type but there is no caret. You can get the caret back by switching to another application (ALT-TAB) and then press ALT-TAB again to go back.

      On JDK 1.4 (1.4.0-b92) it behaves different, you can not type at all in the JTextArea. Switching from application does not help either.

      You can make the application work with both JDK's if you change the "extends
      JWindow" to "extends JFrame". For our application we need to able to use
      JWindow.

      The test program is tested against Windows 2000 Professional.

      //TestInternalFrameCuror.java
      import javax.swing.*;
      import javax.swing.event.InternalFrameAdapter;
      import javax.swing.event.InternalFrameEvent;
      import java.awt.Component;
      import java.awt.Window;

      /**
       * This class shows the bug with the invisible caret in a JTextArea with an
       * internal frame
       */
      public class TestInternalFrameCursor extends JWindow
      {
      public static void main( String[] args )
      {
      TestInternalFrameCursor window = new TestInternalFrameCursor();
      window.setSize( 300, 300 );
      window.setVisible( true );
      }

      public TestInternalFrameCursor()
      {
      super();

      setContentPane( new JDesktopPane() );

      final JInternalFrame internalFrame = new JInternalFrame( "Title", true, true );
      JPanel panel = createPanel();
      internalFrame.getContentPane().add( panel );
      getContentPane().add( internalFrame );
      internalFrame.addInternalFrameListener( new InternalFrameAdapter()
      {
      public void internalFrameClosed( InternalFrameEvent e )
      {
      System.exit( 0 );
      }
      } );

      internalFrame.pack();
      internalFrame.setVisible( true );
      }

      private JPanel createPanel()
      {
      JPanel panel = new JPanel();
      JTextArea textArea = new JTextArea( 5, 25 );
      panel.add( new JScrollPane( textArea ) );
      return panel;
      }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              idk Igor Kushnirskiy (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: