Dil.
Dil.

Reputation: 2076

How to order records by the date in a JTable?

This is my GUI. I basically want the records in the JTable to be in ascending order of date.

enter image description here


Can you please give an idea how to do this?

Upvotes: 0

Views: 515

Answers (2)

Naveen
Naveen

Reputation: 683

Alternatively this works as well:

JTable.getRowSorter().toggleSortOrder(index);

index refers to the index of the column you want to arrange the records as of.

Upvotes: 1

roeygol
roeygol

Reputation: 5048

Try to see this example, I think it may help you http://www.java2s.com/Tutorial/Java/0240__Swing/SampleSortingTableModel.htm

Upvotes: 1

Related Questions