You can either implement the Comparator
interface, as shown in How to Use Tables: Sorting and Filtering, or implement the Comparable
Interface, as shown in the class Value
of this example. In either approach, you can alter the result of the comparison method in a way that causes the desired row(s) to appear after all others.
Addendum: As @kleopatra's answer notes, the Comparator
must be applied in the context of the table's RowSorter
, while an implementation of Comparable
would affect the natural ordering. As the result is convoluted and hard to maintain, you may want to look at an alternate approach.