classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: fix for JComboBox


From: Robert Schuster
Subject: [cp-patches] FYI: fix for JComboBox
Date: Sun, 19 Dec 2004 23:40:01 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.3) Gecko/20040930

This patch removes the code that preselected the first item in the model. I found out that >=1.4 does not do this. Mauve tests comming soon.

2004-12-19  Robert Schuster <address@hidden>

       * javax/swing/JComboBox.java:
       (JComboBox): Removed selection of the
       first item in the model.

cu
Robert
Index: javax/swing/JComboBox.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComboBox.java,v
retrieving revision 1.11
diff -u -r1.11 JComboBox.java
--- javax/swing/JComboBox.java  18 Dec 2004 19:54:53 -0000      1.11
+++ javax/swing/JComboBox.java  19 Dec 2004 22:25:10 -0000
@@ -192,8 +192,9 @@
   private Object prototypeDisplayValue;
 
   /**
-   * Constructs JComboBox object with specified data model for it. The first
-   * item in the specified data model is selected by default.
+   * Constructs JComboBox object with specified data model for it.
+   * <p>Note that the JComboBox will not change the value that
+   * is preselected by your ComboBoxModel implementation.</p>
    *
    * @param model Data model that will be used by this JComboBox to keep track
    *        of its list of items.
@@ -206,11 +207,6 @@
     setModel(model);
     setActionCommand("comboBoxChanged");
 
-    /* By default set selected item to the first element in the combo box
-     * or select nothing if there are no elements.
-     */
-    setSelectedIndex(getItemCount() != 0 ? 0 : -1);    
-
     lightWeightPopupEnabled = true;
     isEditable = false;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]