如何在JTable中按日期订购记录?

时间:2015-01-16 09:45:48

标签: java swing jtable

这是我的GUI。我基本上希望JTable中的记录按日期的升序排列。

enter image description here


你能问一下如何做到这一点吗?

2 个答案:

答案 0 :(得分:1)

试着看看这个例子,我想它可能对你有帮助 http://www.java2s.com/Tutorial/Java/0240__Swing/SampleSortingTableModel.htm

答案 1 :(得分:1)

或者这也适用:

  

JTable.getRowSorter()toggleSortOrder(的索引);

索引是指您要将记录排列为的列的索引。