JDK 6 以前のJTable
Sort JTables with TableSorter
Section titled “Sort JTables with TableSorter”
TableSorter
This example uses TableSorter.java, which was available in TheJava™ Tutorial prior to JDK 1.5.0, to sort rows in a JTable in descending, ascending, and initial state.
The selection state is maintained even when sorting with TableSorter.
Section titled “The selection state is maintained even when sorting with TableSorter.”
SelectionKeeper
Even when sorting using TableSorter.java, the row selection state is saved.
JTable sorting
Section titled “JTable sorting”
SortableTable
Clicking on the column headers in the JTable sorts the rows in descending or ascending order.
Make the JTableHeader column unselectable.
Section titled “Make the JTableHeader column unselectable.”
DisabledHeader
This disables the selection of columns in the JTableHeader, preventing sorting and other operations.