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

REGRESSION: Editable JComboBox won't hide popup when tabbing out

XMLWordPrintable

    • b14
    • x86
    • windows_xp

        Name: gm110360 Date: 09/10/2004


        FULL PRODUCT VERSION :
        1.5.0-rc-b63

        A DESCRIPTION OF THE PROBLEM :
        When tabbing out of an editable JComboBox to another control its popup-list will remain visible. Changing focus by clicking on a different control via mouse will hide popup.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Open a combobox's popup list. Switch to the textfield using the tabulator key => Popup remains visible
        Switch back (Shift+Tab). Switch to the textfield using a mouse click => Popup is hidden

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        See above. Popup should be hidden when tabbing out.
        ACTUAL -
        Popup remains open.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class ComboTest {
          public static void main(String[] args) {
                JFrame frame = new JFrame();
                frame.getContentPane().setLayout(new java.awt.FlowLayout());
                JComboBox comboBox = new JComboBox(new Object[] {"A", "B"});
                comboBox.setEditable(true);
                frame.getContentPane().add(comboBox);
                frame.getContentPane().add(new JTextField("I wan't more focus!"));
                frame.pack(); frame.setVisible(true);
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        hidePopupOnFocusLoss=System.getProperty("java.version").startsWith("1.5");

        comboBox.getEditor().getEditorComponent().addFocusListener(new FocusAdapter() {
          public void focusLost(FocusEvent e) {
            if (hidePopupOnFocusLoss) comboBox.setPopupVisible(false);
          }
        });

        Release Regression From : 1.4.2
        The above release value was the last known release where this
        bug was known to work. Since then there has been a regression.

        (Incident Review ID: 302409)
        ======================================================================
        ###@###.### 11/2/04 18:07 GMT

              kizune Alexander Zuev
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: