< prev index next >

## src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java

Print this page

    *** 453,462 ****
    --- 453,463 ----
              changeSelection(clearMin, clearMax, setMin, setMax, true);
          }

          /** {@inheritDoc} */
          public void clearSelection() {
    +         updateLeadAnchorIndices(-1, -1);
              removeSelectionIntervalImpl(minIndex, maxIndex, false);
          }

          /**
           * Changes the selection to be between {@code index0} and {@code index1}
    *** 689,710 ****
              for(int i = rmMinIndex; i <= maxIndex; i++) {
                  setState(i, value.get(i + gapLength));
              }

              int leadIndex = this.leadIndex;
    !         if (leadIndex == 0 && rmMinIndex == 0) {
    !             // do nothing
    !         } else if (leadIndex > rmMaxIndex) {
                  leadIndex = this.leadIndex - gapLength;
              } else if (leadIndex >= rmMinIndex) {
                  leadIndex = rmMinIndex - 1;
              }

              int anchorIndex = this.anchorIndex;
    !         if (anchorIndex == 0 && rmMinIndex == 0) {
    !             // do nothing
    !         } else if (anchorIndex > rmMaxIndex) {
                  anchorIndex = this.anchorIndex - gapLength;
              } else if (anchorIndex >= rmMinIndex) {
                  anchorIndex = rmMinIndex - 1;
              }

    --- 690,707 ----
              for(int i = rmMinIndex; i <= maxIndex; i++) {
                  setState(i, value.get(i + gapLength));
              }

              int leadIndex = this.leadIndex;
    !         if (leadIndex > rmMaxIndex) {
                  leadIndex = this.leadIndex - gapLength;
              } else if (leadIndex >= rmMinIndex) {
                  leadIndex = rmMinIndex - 1;
              }

              int anchorIndex = this.anchorIndex;
    !         if (anchorIndex > rmMaxIndex) {
                  anchorIndex = this.anchorIndex - gapLength;
              } else if (anchorIndex >= rmMinIndex) {
                  anchorIndex = rmMinIndex - 1;
              }

< prev index next >