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

Launching a modal dialog in processFocusEvent makes application hang

    • mantis
    • x86
    • windows_xp


      ###@###.### 2002-07-26

      J2SE Version (please include all output from java -version flag):
        java version "1.4.1-rc"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b16)
        Java HotSpot(TM) Client VM (build 1.4.1-rc-b16, mixed mode)

      Does this problem occur on J2SE 1.3 or 1.4? Yes / No (pick one)
       Yes, occurs on J2SE 1.4.0_01 too.


      Operating System Configuration Information (be specific):
        Windows XP (All patches to date were applied)

      Hardware Configuration Information (be specific):
        PIII 650MHz, RAM 384MB, Rage 128 8MB RAM

      Bug Description:
        Launching a modal dialog in processFocusEvent makes application hang.

      Steps to Reproduce (be specific):
        Run the following program. When focus is moved away from the frame,
        the dialog launches and the application just hangs. If you try to the
        same thing in processMouseEvent, it works well.

      Test program:(Test.java):
      ===========================================================================
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class Test {

          public static void main(String[] args) {
              final JFrame f = new JFrame();
              JTextField t = new JTextField("TEST") {
                  { enableEvents(AWTEvent.FOCUS_EVENT_MASK
                               | AWTEvent.MOUSE_EVENT_MASK); }
                  protected void processFocusEvent(FocusEvent e) {
                      super.processFocusEvent(e);
                      if (e.getID() == FocusEvent.FOCUS_LOST) {
                          JOptionPane.showMessageDialog(f, "Check");
                      }
                  }
                  protected void processMouseEvent(MouseEvent e) {
                      super.processMouseEvent(e);
      // JOptionPane.showMessageDialog(f, "Check");
                  }
              };
              f.getContentPane().add(t);
              f.setBounds(100, 100, 200, 200);
              f.show();
          }
      }

            son Oleg Sukhodolsky (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: