Updated multiple selection in JLists.  Now after a remove operation, the
next add operation works in accordance with the reference
implementations.

Patch attached.

        2005-07-07  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/DefaultListSelectionModel.java:
        (addSelectionInterval): Added check for leadSelectionIndex being
        unselected (ie - after a remove operation).

-Tony
Index: javax/swing/DefaultListSelectionModel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultListSelectionModel.java,v
retrieving revision 1.18
diff -u -r1.18 DefaultListSelectionModel.java
--- javax/swing/DefaultListSelectionModel.java	2 Jul 2005 20:32:47 -0000	1.18
+++ javax/swing/DefaultListSelectionModel.java	7 Jul 2005 20:42:52 -0000
@@ -436,10 +436,12 @@
     
     // The next if statements breaks down to "if this selection is adjacent
     // to the previous selection and going in the same direction"
-    if (((index0 - 1 == leadSelectionIndex && (index1 >= index0) 
-              && (leadSelectionIndex >= anchorSelectionIndex))
-             || (index0 + 1 == leadSelectionIndex && (index1 <= index0) 
-                 && (leadSelectionIndex <= anchorSelectionIndex)))
+    if ((isSelectedIndex(leadSelectionIndex)) 
+        && ((index0 - 1 == leadSelectionIndex 
+             && (index1 >= index0) 
+             && (leadSelectionIndex >= anchorSelectionIndex))
+            || (index0 + 1 == leadSelectionIndex && (index1 <= index0) 
+                && (leadSelectionIndex <= anchorSelectionIndex)))
         && (anchorSelectionIndex != -1 || leadSelectionIndex != -1))
       {
         // setting setLeadCalledFromAdd to true tells setLeadSelectionIndex
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to