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

JComboBox: Cursorkeys not working correctly when null-Value is in the list.

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b41)
      Java HotSpot(TM) Client VM (build 14.0-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If you use an noneditable JComboBox and you have a null-Value in the list, the cursorkeys are not working correctly. In my enclosed test case you cannot walk throu the list with cursor down. "End" and "Home" and inserting characters to select a value will work.

      Try to traverse with the cursorkeys without(!) opening the list of
      elements. It doesn't work when the null-element is selected.. Typing
      characters ("t" or "f") or the end-key works. Also traversing with the
      cursorkeys works when "Foo" or "Test" is selected - until the null element
      ist selected.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;
      import javax.swing.WindowConstants;

      import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;

      public class test {

          public static void main(String[] args) throws
      UnsupportedLookAndFeelException {

              UIManager.setLookAndFeel(new WindowsLookAndFeel());
       
              JFrame frame = new JFrame();
              frame.setTitle(System.getProperty("java.version"));
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                frame.add(new JComboBox(new Object[] { null, "Test", "Foo" }));
              frame.pack();
              frame.setVisible(true);

          }
      }
      ---------- END SOURCE ----------

            dnguyen Damon Nguyen
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: