Trying to order a jtable by the Days of week column since the day of week names are not in order once they are displayed on the jtable. Beans binding has been used to link database(MYSQL) with the jtable, but i need an event to sort the entries by the day of week column (Mon, Tues....in this order).
You can add a RowSorter to the JTable and the user can click on any heading to do a sort.
If you want to presort the data then you can manually do a sort:
table.setAutoCreateRowSorter(true);
DefaultRowSorter sorter = ((DefaultRowSorter)table.getRowSorter());
ArrayList list = new ArrayList();
list.add( new RowSorter.SortKey(2, SortOrder.ASCENDING) );
sorter.setSortKeys(list);
sorter.sort();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.