Reputation: 176
Are there any equivalent functions for getting the sorting option for the headers in the JTable? Or are there any workarounds available?
Basically, I cannot execute this function because I am currently using Java 1.4, and upgrading the jdk is not an option.
if (table.getRowSorter().getSortKeys().get(column).getSortOrder() == SortOrder.DESCENDING) {
return SortOrder.DESCENDING;
}
When compiling the code above it cannot find the method for getSortOrder().
Upvotes: 0
Views: 308
Reputation: 347332
TableRowSorter
was introduced in Java 1.6, so there is no equivalent API available for Java 1.4
Instead, if row sorting is important to you, you will need to implement a sorting mechanism of your own.
When I started with Java 1.3, we wrote a "proxy" model which would do a virtual sort (the proxy model would act as a wrapper around a TableModel
and mapped the indices from the TableModel
to the JTable
so as to make it appear as if it was sorted)
Upvotes: 3