for (i = 0; i < idx0; i++) x0 += columnModel.getColumn(i).getWidth();  int xn = x0;  for (i = idx0; i <= idxn; i++) xn += columnModel.getColumn(i).getWidth();  repaint(x0, 0, xn-x0, getHeight());
int minRow = 0; int maxRow = getRowCount() - 1; if (getRowSelectionAllowed()) { minRow = selectionModel.getMinSelectionIndex(); maxRow = selectionModel.getMaxSelectionIndex(); int leadRow = selectionModel.getLeadSelectionIndex(); if (minRow == -1 && maxRow == -1) { minRow = leadRow; maxRow = leadRow; } else {   if (leadRow != -1) { minRow = Math.min(minRow, leadRow); maxRow = Math.max(maxRow, leadRow); } } } if (minRow != -1 && maxRow != -1) { Rectangle first = getCellRect(minRow, idx0, false); Rectangle last = getCellRect(maxRow, idxn, false); Rectangle dirty = SwingUtilities.computeUnion(first.x, first.y, first.width, first.height, last); repaint(dirty); }
  public void columnSelectionChanged (ListSelectionEvent event)  {    // Does not make sense for the table with the single column.    if (getColumnCount() < 2)      return;        int x0 = 0;        int idx0 = event.getFirstIndex();    int idxn = event.getLastIndex();    int i;    for (i = 0; i < idx0; i++)      x0 += columnModel.getColumn(i).getWidth();        int xn = x0;        for (i = idx0; i <= idxn; i++)      xn += columnModel.getColumn(i).getWidth();        repaint(x0, 0, xn-x0, getHeight());  }