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

Focus not handled correctly after two consecutive dialogs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: skT45625 Date: 10/23/2000


      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)

      If more than one dialog is displayed during focusLost processing, it will no
      longer be possible to set focus to the JComponent. This problem occurs under NT
      4.0 and Win2000. It behaves correctly under Win95. The following code
      demonstrates the problem.

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

      class DlgTest extends JFrame {
        public static void main(String argv[]) {
          new DlgTest().addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent ev) {
              System.exit(0);
            }
          });
        }

        public DlgTest() {
          super("Test Frame");
          setSize(350,100);
          Panel p = new Panel();
          p.setLayout(new FlowLayout());
          setContentPane(p);

          JTextField fld1 = new JTextField("field 1", 20);
          JTextField fld2 = new JTextField("field 2", 20);

          fld1.addFocusListener(new FocusProcessor(this));

          p.add(fld1);
          p.add(fld2);

          setVisible(true);
        }

        class FocusProcessor implements FocusListener {
          JFrame frame;

          public FocusProcessor(JFrame frame) {
            this.frame = frame;
          }

          public void focusGained(FocusEvent e) {
          }

          public void focusLost(FocusEvent e) {
            if (! e.isTemporary()) {
              JOptionPane.showMessageDialog(frame, "message 1");
              JOptionPane.showMessageDialog(frame, "message 2");
            }
          }
        }
      }

      This will create a frame containing two text fields. Tab out of field 1. Two
      message dialogs will appear. After closing the dialogs, a cursor is still
      visible in field 1 even though field 2 has focus. It is not possible to set
      focus back to field 1.
      (Review ID: 111252)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                peterz Peter Zhelezniakov (Inactive)
                Reporter:
                skondamasunw Suresh Kondamareddy (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: