JDK-6893325 : JComboBox and dragging to an item outside the bounds of the containing JFrame is not selecting that
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u16
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2009-10-20
  • Updated: 2011-02-16
  • Resolved: 2010-06-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Fixed
Description
The  problem is only that clicking and holding on the JComboBox and dragging to an item outside the bounds of the containing JFrame is not selecting that item that was highlighted when the mouse was released. No other windows/frames/etc. are involved in reproducing the bug.

This problem is on Solaris and CDE/Java Desktop on XWindows, on both the x86 and SPARC 

Reproducable test case 

For a JComboBox, if you click and hold and then release the mouse button on an item that is significantly outside the bounds of the JFrame that the JComboBox was contained in, it will not select that item and a popup menu cancelled event is fired. If you click the combo box and release, and then click the same item as before, it will select that item correctly. If you click and hold and then release the mouse button on an item that is within the confines of the Jframe that contains the JComboBox, then that item WILL be selected correctly.

This was verified to have worked correctly in Java 5, and appears to be a new problem for Java 6.

Reproducable test case
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;


public class ComboBoxBug 
{
    public static final void main(String[] args) {
        JFrame frame = new JFrame("Combo Box Bug");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setLayout(new FlowLayout());

        final JComboBox comboBox = new JComboBox(new Object[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"});

        comboBox.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.err.println("Action performed!");
                }
            });

        comboBox.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    System.err.println("Item state changed!");
                }
            });

        comboBox.addPopupMenuListener(new PopupMenuListener() {
                public void popupMenuCanceled(PopupMenuEvent e) {
                    System.err.println("Popup menu cancelled!");
                }
                public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                    System.err.println("Popup menu will become invisible!");

                }
                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                    System.err.println("Popup menu will become visible!");
                }
            });

        frame.getContentPane().add(comboBox);
        frame.pack();
        frame.setVisible(true);
    }

Comments
EVALUATION please see the parent CR
08-02-2010