You can define an intermediary class that references every JTable RowSorter and registers as a RowSorterListener with each sorter. When this sorter changes, you can get the current list of sort keys using getSortKets() and pass them to each sorter using setSortKeys(List<? extends SortKey>) .
Example
First, we define the mediation class:
public class SortMediator implements RowSorterListener { private final List<RowSorter> sorters; private boolean changing; public void addRowSorter(RowSorter sorter) { this.sorters.add(sorter); } public void sorterChanged(RowSorterEvent e) { ... } }
Now we implement sorterChanged(RowSorterEvent e) to respond to the specified sorter event:
public void sorterChanged(RowSorterEvent e) {
source share