[cp-patches] FYI: DefaultComboBoxModel.removeElementAt() fixlet

David Gilbert david.gilbert at object-refinery.com
Fri Jun 16 14:19:24 UTC 2006


This patch (committed) ensures that the removeElementAt() method fires an event when 
the selection is changed because of the removal:

2006-06-16  David Gilbert  <david.gilbert at object-refinery.com>

	* javax/swing/DefaultComboBoxModel.java
	(removeElementAt): Set new selected item by calling setSelectedItem().

I'll commit the corresponding Mauve test in a moment.

Regards,

Dave
-------------- next part --------------
Index: javax/swing/DefaultComboBoxModel.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/DefaultComboBoxModel.java,v
retrieving revision 1.15
diff -u -r1.15 DefaultComboBoxModel.java
--- javax/swing/DefaultComboBoxModel.java	31 Mar 2006 09:45:48 -0000	1.15
+++ javax/swing/DefaultComboBoxModel.java	16 Jun 2006 14:12:16 -0000
@@ -146,9 +146,9 @@
     if (selected == index) // choose a new selected item
       {
         if (selected > 0)
-          selectedItem = getElementAt(selected - 1);
+          setSelectedItem(getElementAt(selected - 1));
         else 
-          selectedItem = getElementAt(selected + 1);
+          setSelectedItem(getElementAt(selected + 1));
       }
     list.removeElementAt(index);
     fireIntervalRemoved(this, index, index);


More information about the Classpath-patches mailing list