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

Caret not visible using JWindow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs



      Name: ssT124754 Date: 01/26/2001


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


      The following code demonstrates a simple application containing a text.
      Applications based on a JFrame behave as expected. Applications based on
      JWindow do not show a caret in JTextArea or JTextField. Although the caret
      never shows up, you can still edit text, and you can still select your position
      using arrow keys or the mouse.

      package demo;

      import java.awt.BorderLayout;
      import java.awt.Container;
      import java.awt.Window;

      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import javax.swing.JFrame;
      import javax.swing.JWindow;
      import javax.swing.JPanel;
      import javax.swing.JTextArea;
      import javax.swing.JTextField;
      import javax.swing.border.EmptyBorder;

      public class CaretDemo extends JPanel {
        
      public CaretDemo() {
      setLayout(new BorderLayout(5,5));
      setBorder(new EmptyBorder(10,10,10,10));

      JTextField textField = new JTextField("Where is the JTextField
      caret?");
      add(textField, BorderLayout.NORTH);

      JTextArea textArea = new JTextArea("Where is the JTextArea
      caret?");
      add(textArea, BorderLayout.CENTER);
      }
        
        public static void main(String [] args) {
        
       // JFrame parent = new JFrame();
          JWindow parent = new JWindow();
        
      parent.setBounds(100, 100, 600, 200);

      Container container = parent.getContentPane();
      container.add(new CaretDemo());

      parent.setVisible(true);
      }
      }
      (Review ID: 115794)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            ssultanasunw Shaheen Sultana (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: