--- a/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java Thu Mar 08 15:26:32 2012 -0800
+++ b/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java Tue Mar 13 13:18:07 2012 +0200
@@ -252,6 +252,10 @@
// Updates first and last change indices
private void markAsDirty(int r) {
+ if (r == -1) {
+ return;
+ }
+
firstAdjustedIndex = Math.min(firstAdjustedIndex, r);
lastAdjustedIndex = Math.max(lastAdjustedIndex, r);
}
@@ -358,16 +362,12 @@
private void updateLeadAnchorIndices(int anchorIndex, int leadIndex) {
if (leadAnchorNotificationEnabled) {
if (this.anchorIndex != anchorIndex) {
- if (this.anchorIndex != -1) { // The unassigned state.
- markAsDirty(this.anchorIndex);
- }
+ markAsDirty(this.anchorIndex);
markAsDirty(anchorIndex);
}
if (this.leadIndex != leadIndex) {
- if (this.leadIndex != -1) { // The unassigned state.
- markAsDirty(this.leadIndex);
- }
+ markAsDirty(this.leadIndex);
markAsDirty(leadIndex);
}
}