private int selectionSpan(SelectionModel sm, int orientation) { if (orientation == SwingConstants.VERTICAL) { return sm.getLastSelectedRow() - sm.getFirstSelectedRow() + 1; } else { return sm.getLastSelectedColumn() - sm.getFirstSelectedColumn() + 1; } }
private int compare(int i, SelectionModel sm, int orientation) { int min = 0; int max = 0; if (orientation == SwingConstants.VERTICAL) { min = sm.getFirstSelectedRow(); max = sm.getLastSelectedRow(); } else { min = sm.getFirstSelectedColumn(); max = sm.getLastSelectedColumn(); } return compare(i, min, max + 1); }