Index: javax/swing/DefaultListSelectionModel.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultListSelectionModel.java,v retrieving revision 1.23 diff -u -r1.23 DefaultListSelectionModel.java --- javax/swing/DefaultListSelectionModel.java 18 Oct 2005 17:48:03 -0000 1.23 +++ javax/swing/DefaultListSelectionModel.java 20 Oct 2005 20:48:47 -0000 @@ -238,6 +238,9 @@ */ public void setLeadSelectionIndex(int leadIndex) { + if (selectionMode == SINGLE_SELECTION) + setSelectionInterval (leadIndex, leadIndex); + int oldLeadIndex = leadSelectionIndex; if (oldLeadIndex == -1) oldLeadIndex = leadIndex; @@ -436,7 +439,7 @@ oldSel = sel.clone(); if (selectionMode == SINGLE_SELECTION) - sel.clear(); + setSelectionInterval(index0, index1); // COMPAT: Like Sun (but not like IBM), we allow calls to // addSelectionInterval when selectionMode is @@ -447,10 +450,7 @@ isSelectedIndex(index1) || isSelectedIndex(Math.max(lo-1,0)) || isSelectedIndex(Math.min(hi+1,sel.size())))) - sel.clear(); - - if (selectionMode == SINGLE_SELECTION) - index0 = index1; + sel.clear(); // We have to update the anchorSelectionIndex and leadSelectionIndex // variables Index: javax/swing/JList.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JList.java,v retrieving revision 1.36 diff -u -r1.36 JList.java --- javax/swing/JList.java 19 Oct 2005 15:45:03 -0000 1.36 +++ javax/swing/JList.java 20 Oct 2005 20:48:47 -0000 @@ -1384,7 +1384,7 @@ n++; int [] v = new int[n]; j = 0; - for (i = lo; i < hi; ++i) + for (i = lo; i <= hi; ++i) if (selectionModel.isSelectedIndex(i)) v[j++] = i; return v;