I have a number of JXTables which all have the same columns (but different data). You can sort the data by clicking on one the header of one of the columns. What I want now, is that the other tables are sorted the same way when clicking on the header of one of the table.
Share
You could define a mediator class that references each
JTable‘sRowSorterand registers itself as aRowSorterListenerwith each sorter. When a given sorter changes you could retrieve its current list of sort keys usinggetSortKets()and pass them to every other sorter usingsetSortKeys(List<? extends SortKey>).Example
First we define the mediator class:
Now we implement
sorterChanged(RowSorterEvent e)to respond to a given sorter event: