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

Focus in Jtextfield gets messed up when covered by a window (dtterm)

XMLWordPrintable

    • sparc
    • solaris_8

      When a java application has 2 or more Jtextfields, focus in the Jtextfields
      gets messed up when a UNIX dtterm covers it partially and closed back. This
      only happens if the Open key on the left edge of the keyboard is used to
      close the dtterm. Everything works fine when the mouse is used. The following
      test case shows the problem.
      The problem occurs in jdk 1.3.1_01 on solaris 8. It works fine in 1.4 beta. But the customer needs a fix for 1.3.1_01.


      When the program first comes up, three JTextFields are displayed.
      You can click in any of them and type and everything works fine.
      Now, cover a portion of the java application with a UNIX dtterm
      and then close the dtterm. Now when you click in each JTextField,
      and try to type they will not all work. If you click in a JTextField
      which does not have the blinking insert caret, and then open the UNIX
      dtterm window so that it covers the java program, and then close
      the dtterm again, you will get an extra blinking caret. Repeating
      this, you can get blinking carets in all three JTextFields. At least
      one of the JTextFIelds will not accept keyboard entry.

      NOTE:
      =====
      If I only ever use the mouse to open and close the dtterm, the java
      application works correctly. If I use the Open key on the left edge
      of the keyboard to close the dtterm, then the focus starts to get confused.




      // FocusBug.java code

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

      public class FocusBug extends JFrame {
      JTextField text1;
      JTextField text2;
      JTextField text3;

      FocusBug() {
      Container content = getContentPane();
      content.setLayout(new GridLayout(3, 1));
      setSize(new Dimension(800, 200));
      text1 = new JTextField("textfield 1 ");
      text2 = new JTextField("textfield 2 ");
      text3 = new JTextField("textfield 3 ");
      content.add(text1);
      content.add(text2);
      content.add(text3);
                  setLocation(200, 200);
      addWindowListener (new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      }
      public void windowOpened(WindowEvent e) {
      repaint();
      text1.requestFocus();
      }
      });
      validate();
      setVisible(true);
      }

      public static void main(String[] args) {
      new FocusBug();
      }
      }

            prssunw Prs Prs (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: