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

JComboBox does not open correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_01"
      Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP2

      A DESCRIPTION OF THE PROBLEM :
      Clicking on a JComboBox does not open the drop down list correctly. The list is briefly displayed, then it is hidden. This happens only for instances of JComboBox that are inside a JWindow, instances contained inside of a JDialog work fine. I noticed that the JWindow fires an UngrabEvent that determines the BasicComboPopup to be hidden.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Click on a JComboBox located inside of a JWindow

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the drop-down list containing the items is supposed to be displayed
      ACTUAL -
      the drop-down list is briefly displayed, an UngrabEvent is fired by the JWindow. The UngrabEvent determines the drop-down list to be hidden

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import sun.awt.UngrabEvent;
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class Test {
          private static void createWindow() {
              final JWindow w = new JWindow();

              Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
                  public void eventDispatched(AWTEvent event) {
                      if (event instanceof UngrabEvent) {
                          System.out.println("UngrabEvent " + event);
                      }
                  }
              }, 0xFFFFFFFF);

              w.setLayout(new BorderLayout());
              JComboBox combo = new JComboBox();
              combo.addItem("item1");
              combo.addItem("item2");
              w.add(combo, BorderLayout.NORTH);
              w.setSize(200, 200);
              w.setLocationRelativeTo(null);
              w.setVisible(true);
          }

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      Test.createWindow();
                  }
              });
          }
      }
      ---------- END SOURCE ----------

            son Oleg Sukhodolsky (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: