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

JComboBox and dragging to an item outside the bounds of the containing JFrame is not selecting that

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b07
    • CPU:
      sparc
    • OS:
      solaris_10
    • Verification:
      Verified

      Backports

        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);
            }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                vchoudhaorcl Vaibhav Choudhary (Inactive)
                Reporter:
                dvanero Dennis Van Eron
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: