Here comes a small fix for DefaultListSelectionModel. Mauve test for this
is also committed.
2005-10-28 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/DefaultListSelectionModel.java
(setLeadSelectionIndex): Forbit some changes to leadSelectionIndex
when the anchorSelectionIndex is not set properly.
/Roman
Index: javax/swing/DefaultListSelectionModel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultListSelectionModel.java,v
retrieving revision 1.24
diff -u -r1.24 DefaultListSelectionModel.java
--- javax/swing/DefaultListSelectionModel.java 20 Oct 2005 20:53:14 -0000 1.24
+++ javax/swing/DefaultListSelectionModel.java 28 Oct 2005 14:23:48 -0000
@@ -238,6 +238,19 @@
*/
public void setLeadSelectionIndex(int leadIndex)
{
+ // Only set the lead selection index to < 0 if anchorSelectionIndex < 0.
+ if (leadIndex < 0)
+ {
+ if (anchorSelectionIndex < 0)
+ leadSelectionIndex = -1;
+ else
+ return;
+ }
+
+ // Only touch the lead selection index if the anchor is >= 0.
+ if (anchorSelectionIndex < 0)
+ return;
+
if (selectionMode == SINGLE_SELECTION)
setSelectionInterval (leadIndex, leadIndex);
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches