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 8418623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:23:00+00:00 2026-06-10T02:23:00+00:00

How can I use one scroll from one JScrollPane to move another or more

  • 0

How can I use one scroll from one JScrollPane to move another or more than one JScrollPane?

In example:

I have three JTables in separate JScrollPanes. I want to bind the scrollpanes to each other.

If I’ll use one – the another will scroll the same way.

Some kind of Listeners which i can’t find?

Any sugestions?

Best regards.

  • 1 1 Answer
  • 0 Views
  • 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-06-10T02:23:01+00:00Added an answer on June 10, 2026 at 2:23 am

    An approach that preserves the JTables‘ headers would be to use the same BoundedRangeModel for each JScrollPane‘s vertical scrollbar and add each ScrollPane to a single JPanel.

    class ParallelTables {
        static JScrollPane createTable() {
            DefaultTableModel model = new DefaultTableModel(100, 2);
            for (int row=model.getRowCount(); --row>=0;) {
                model.setValueAt(row, row, 0);
            }
            JTable table = new JTable(model);
            return new JScrollPane(table);
        }
    
        public static void main(String[] args) throws Exception {
    
            JScrollPane scrollerA = createTable();
            JScrollPane scrollerB = createTable();
            scrollerA.setVerticalScrollBarPolicy(
                    JScrollPane.VERTICAL_SCROLLBAR_NEVER);
            // the following statement binds the same BoundedRangeModel to both vertical scrollbars.
            scrollerA.getVerticalScrollBar().setModel(
                    scrollerB.getVerticalScrollBar().getModel());
            JPanel panel = new JPanel();
            panel.add(scrollerA);
            panel.add(scrollerB);
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(panel);
            frame.pack();
            frame.setVisible(true);
        }
    }
    

    Reference:

    • https://forums.oracle.com/forums/thread.jspa?threadID=1348214
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question. I'm new to Clojure. How can I use one file from my
In servlet 3.0 one can use startAsync to put long work in another thread,
I am trying to use jquery to do an animated scroll from one div
Is there a way I can use one category to stylize all of my
What is safer? I can use either one as I'm using CodeIgniter, but with
How can one use Triggers for Logging History of database changes in MySQL? If
In *nix systems one can use which to find out the full path to
Are there any HTTP headers one can use to detect a mobile users number
I am wondering if there is a library one can use that calculates elapsed
In VIM, One can use % to indicate the current filename when invoking a

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.