I have a JTable and a TableRowSorter which I'd like to perform an operation after a sort is finished. I've been browsing the net, and so far I haven't had much luck.
Initially I thought just a RowSorterListener would do the trick, but unfortunately it doesn't perform the operation after the sort is finished.
Adding a MouseListener to the JTable header could work, but the solution isn't terribly elegant.
Does anyone have any ideas?
Thanks a bunch!
Edit (from comment): The following is added in a method inside a custom TableModel class which extends AbstractTableModel. This method is invoked whenever the JTable is set/specified in the custom TableModel class.
sorter.addRowSorterListener(new RowSorterListener() {
@Override public void sorterChanged(RowSorterEvent rowsorterevent) {
rebuildMItems(); // The method which executes
}
});