aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to scroll tables on both sides of splitpane in sync? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to scroll tables on both sides of splitpane in sync?" Watch "How to scroll tables on both sides of splitpane in sync?" New topic
Author

How to scroll tables on both sides of splitpane in sync?

Sarone Thach
Ranch Hand

Joined: Jun 25, 2003
Posts: 89
Hi There,
I have a JScrollPane scrollpane1, I've added a JSplitPane. On each side of the split pane are a JTable. The JTables are in sync with eachother. row 1 of table on left, correspond to row1 data of table on right of splitpane.
However, I have a scrolling problem. When I need to scroll one table, i need to scroll the other by the same amount. Do i really need to put each of the table on a JScrollPane??
Or can I somehow manipulate the scrollpane1?
please could i get some help.
Thanks,
Sarone
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6


I am still working on what needs to be done to actually move the other scrollpane, but I will work on it and let you know.


GenRocket - Experts at Building Test Data
Sarone Thach
Ranch Hand

Joined: Jun 25, 2003
Posts: 89
Ok I have decided to put the JTable on a JScrollPane each.
I have used Gregg's code, and added a vertical adjustment listener.
if I can just set the vertical position of scrollbar1 to be the same as the vertical position of scrollbar2, the one we moved, it would work.
I'm searching in the api to see if I can do this.But can't find it.
If anyone can find it please let me know. Thanks.
Sarone Thach
Ranch Hand

Joined: Jun 25, 2003
Posts: 89
Problem solved:
Do not need an adjustment listener simply do this:

and another cool thing i tripped upon is this:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to scroll tables on both sides of splitpane in sync?