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

click on JComboBox when window is closing causes IllegalComponentStateException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs



      Name: rmT116609 Date: 11/04/2002


      FULL PRODUCT VERSION :
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Windows NT Version 4.0

      A DESCRIPTION OF THE PROBLEM :
      Clicking on a JComboBox before the end of an event dispatch which will close its containing window will cause an IllegalComponentStateException. I expect there may be similar problems with other Swing components.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run source.
      2. Click on "Cancel".
      3. Click on the filter combo before the dialog closes.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expect nothing, get a stack dump.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
           at java.awt.Component.getLocationOnScreen_NoTreeLock
      (Component.java:1507)
           at java.awt.Component.getLocationOnScreen(Component.java:1481)
           at javax.swing.JPopupMenu.show(JPopupMenu.java:906)
           at javax.swing.plaf.basic.BasicComboPopup.show
      (BasicComboPopup.java:177)
           at javax.swing.plaf.basic.BasicComboPopup.togglePopup
      (BasicComboPopup.java:982)
           at
      javax.swing.plaf.basic.BasicComboPopup$InvocationMouseHandler.mousePressed
      (BasicComboPopup.java:632)
           at java.awt.AWTEventMulticaster.mousePressed
      (AWTEventMulticaster.java:218)
           at java.awt.Component.processMouseEvent(Component.java:5090)
           at java.awt.Component.processEvent(Component.java:4890)
           at java.awt.Container.processEvent(Container.java:1566)
           at java.awt.Component.dispatchEventImpl(Component.java:3598)
           at java.awt.Container.dispatchEventImpl(Container.java:1623)
           at java.awt.Component.dispatchEvent(Component.java:3439)
           at java.awt.LightweightDispatcher.retargetMouseEvent
      (Container.java:3450)
           at java.awt.LightweightDispatcher.processMouseEvent
      (Container.java:3162)
           at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
           at java.awt.Container.dispatchEventImpl(Container.java:1609)
           at java.awt.Window.dispatchEventImpl(Window.java:1585)
           at java.awt.Component.dispatchEvent(Component.java:3439)
           at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)^C
           at java.awt.EventDispatchThread.pumpOneEventForHierarchy
      (EventDispatchThread.java:197)
           at java.awt.EventDispatchThread.pumpEventsForHierarchy
      (EventDispatchThread.java:150)
           at java.awt.EventDispatchThread.pumpEvents
      (EventDispatchThread.java:144)
           at java.awt.EventDispatchThread.pumpEvents
      (EventDispatchThread.java:136)
           at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

          public class JComboBoxBug2 {
             public static void main(String args[]) {
               JFileChooser fc =
                      new JFileChooser() {
                         public void cancelSelection() {
                           try {
                              Thread.sleep(2000); }
                               catch(Exception e) {
                              }
                           super.cancelSelection();
                        }
                     };
               fc.showOpenDialog(null);
            }
         }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      You can reduce the frequency of this bug by closing the containing window as soon as possible during event handling.
      (Review ID: 166595)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: