public class SortableTableModel extends TableModel
Constructor and Description |
---|
SortableTableModel(int columns)
Constructs a TableModel.
|
SortableTableModel(int columns,
int rowInitCapacity)
Constructs a TableModel.
|
Modifier and Type | Method and Description |
---|---|
int |
getSortColumn()
Obtains the column index the TableModel is currently sorted by.
|
SortDirection |
getSortDirection()
Obtains the direction the TableModel is currently sorted.
|
void |
sort(int column,
SortDirection direction)
Sorts the TableModel according to the column index and direction.
|
void |
sort(String columnName,
SortDirection direction)
Sorts the TableModel according to the column and direction.
|
columns, getField, getHeader, getHeaders, getRow, newRow, rows, setHeader
public SortableTableModel(int columns)
columns
- The number of columns in the tablepublic SortableTableModel(int columns, int rowInitCapacity)
columns
- The number of columns in the tablerowInitCapacity
- The initial row capacity of the tablepublic void sort(String columnName, SortDirection direction)
columnName
- The name of the column matching the headerdirection
- The direction of the sortpublic void sort(int column, SortDirection direction)
column
- The index of the column to sort bydirection
- The direction of the sortpublic int getSortColumn()
public SortDirection getSortDirection()