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

Windows:JComboBox with heavyweight dropdown list loses focus after dropping list

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • client-libs

      This happens in Win platforms only in the case of a JComboBox with a heavy-weight dropdown list and using keyboard. It works okay with light/medium weight dropdown lists and using mouse.

      To reproduce:
      ------------------
      Run the attached program. The JComboBox can be seen having the focus on it. Hit 'Enter' key to bring down the dropdown list. Now the JComboBox will have lost its focus. Hitting the 'Enter' key will not take the dropdown list back up. Hitting 'Esc' takes the dropdown list back up, but the JComboBox never gains the focus back.

      Code used:
      ---------
      import java.awt.*;
      import java.util.*;
      import javax.swing.*;

      public class testCombo extends JPanel {
        JComboBox combo;

        public testCombo() {
          setPreferredSize(new Dimension(100, 50));
          Vector data = new Vector();
          for (int i = 0;i < 100;i++)
            data.addElement(new Integer(i));
          combo =new JComboBox(data);
          combo.setMaximumRowCount(5);
          add(combo);
        }

        public static void main(String args[]) {
          JFrame frame = new JFrame("Combo Test");

          testCombo t = new testCombo();
          frame.getContentPane().add(t);
          frame.pack();
          frame.setVisible(true);
        }
      }

            mdavidsosunw Mark Davidson (Inactive)
            sramansunw Sridhar Raman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: