JDK-6548397 : JComboBox does not open correctly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-04-20
  • Updated: 2011-02-16
  • Resolved: 2007-10-31
Related Reports
Duplicate :  
Description
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 ----------

Comments
EVALUATION verified that the problem is not reproducible with fix for 6539458 (jdk7b21) so closing this as duplicate.
31-10-2007

EVALUATION looks like a duplicate of 6539458.
31-10-2007

EVALUATION I reproduced this bug on JDK 7 it is the same problem which we discussed with AWT - ungrabEvent on JWindow reassigned to AWT
29-10-2007