Skip to main content

Programatically sort JTable columns

1 reply [Last post]
magdar
Offline
Joined: 2007-03-02

Hi,
I am using the RowSorter class with my Jtable.
My problem is that when i display my table, I need to show the table sorted by descending order of a particular column.
Is there a way to programmatically do sort a particular column in a particular order ?

Thanks,
Mandar

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
digz6666
Offline
Joined: 2007-05-20

If you use JXTable from SwingX, you can do sorting on particular column as following:

tbl_table.setSortOrder(3, SortOrder.ASCENDING);

It sorts ascending by 4th column.

Message was edited by: digz6666