Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 560645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:21:55+00:00 2026-05-13T12:21:55+00:00

I have a number of JXTables which all have the same columns (but different

  • 0

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.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:21:56+00:00Added an answer on May 13, 2026 at 12:21 pm

    You could define a mediator class that references each JTable‘s RowSorter and registers itself as a RowSorterListener with each sorter. When a given sorter changes you could retrieve its current list of sort keys using getSortKets() and pass them to every other sorter using setSortKeys(List<? extends SortKey>).

    Example

    First we define the mediator 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 a given sorter event:

      public void sorterChanged(RowSorterEvent e) {
        // The changing flag prevents an infinite loop after responding to the inital
        // sort event.
        if (!changing) {
          changing = true;
    
          RowSorter changedSorter = e.getSource();
          List<? extends SortKey> keys = changedSorter.getKeys();
    
          for (RowSorter sorter : sorters) {
            if (sorter != changedSorter) {
              // Install new sort keys, which will cause the sorter to re-sort.
              // The changing flag will prevent the mediator from reacting to this.
              sorter.setSortKeys(keys);
            }
          }
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of classes doing different things but using the same Singleton
I have number of text views which have the same attributes only the text
I have number of movieclips which I load on start, they all are instance
I have number of line breaks in a string. But I only want it
We have a number of data objects that realize INotifyPropertyChanged to allow for WPF
I have a number of classes (more than 40), each one has a number
I have number of checkboxes and another checkbox for Select All I want to
I have a number field with duplicate no's (1,1,1,1,2,2,2,2,3,4,5 etc) which defines the position
I have seen number of frameworks implement DI in php. However, since all objects
I need to do something like below. I have number of div with same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.