< prev index next >

## src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java

Print this page

    *** 425,451 ****
           *                  is selected or the <code>selectionModel</code> is
           *                  <code>null</code>
           */
          public int[] getSelectedColumns() {
              if (selectionModel != null) {
    !             int iMin = selectionModel.getMinSelectionIndex();
    !             int iMax = selectionModel.getMaxSelectionIndex();
    !
    !             if ((iMin == -1) || (iMax == -1)) {
    !                 return new int[0];
    !             }
    !
    !             int[] rvTmp = new int[1+ (iMax - iMin)];
    !             int n = 0;
    !             for(int i = iMin; i <= iMax; i++) {
    !                 if (selectionModel.isSelectedIndex(i)) {
    !                     rvTmp[n++] = i;
    !                 }
    !             }
    !             int[] rv = new int[n];
    !             System.arraycopy(rvTmp, 0, rv, 0, n);
    !             return rv;
              }
              return  new int[0];
          }

          // implements javax.swing.table.TableColumnModel
    --- 425,435 ----
           *                  is selected or the <code>selectionModel</code> is
           *                  <code>null</code>
           */
          public int[] getSelectedColumns() {
              if (selectionModel != null) {
    !             return selectionModel.getSelectedIndices();
              }
              return  new int[0];
          }

          // implements javax.swing.table.TableColumnModel
    *** 453,472 ****
           * Returns the number of columns selected.
           * @return the number of columns selected
           */
          public int getSelectedColumnCount() {
              if (selectionModel != null) {
    !             int iMin = selectionModel.getMinSelectionIndex();
    !             int iMax = selectionModel.getMaxSelectionIndex();
    !             int count = 0;
    !
    !             for(int i = iMin; i <= iMax; i++) {
    !                 if (selectionModel.isSelectedIndex(i)) {
    !                     count++;
    !                 }
    !             }
    !             return count;
              }
              return 0;
          }

      //
    --- 437,447 ----
           * Returns the number of columns selected.
           * @return the number of columns selected
           */
          public int getSelectedColumnCount() {
              if (selectionModel != null) {
    !             return selectionModel.getSelectedItemsCount();
              }
              return 0;
          }

      //

< prev index next >