// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
sortType = sortType + (e.isShiftDown() ? -1 : 1);
sortType = (sortType + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
tableModel.setSortingState(tableModel.new SortingState(column, sortType));
h.repaint();
}
}
}
}