I've written something similar once that only worked with DefaultTableModel. What it did was create an Object[] for each row, add those to a List, sort the List (using a Comparator<Object[]>, remove all rows and add all rows again but then sorted. Not quite elegant, and I'd say inefficient if the table has many rows.

There was also no visual signaling on the JTableHeader about which column was sorted last.

I always build my table models from List(s) of custom objects. In 1.5 I used to provide a custom Comparator which used to accept the column index and sort directon which were used by the compare method. I also used "\u2191" and "\u2193" in my table header renderers to provide visual clues on last sorted column and sort direction. By this approach, once you call Collections.sort() all you need to do is call fireTableDataChanged() to referesh the UI. [ October 23, 2008: Message edited by: Maneesh Godbole ]