• Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane and 2 panels

 
Nike Smith
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to scroll 2 panels at the same time. One panel has visible scroll bar.

Any help is highly appreciated. Thank you.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JScrollBar can have AdjustmentListeners which are notified when the adjustment is changed (by scrolling). You can then change the position of the other panel.
 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nike Smith:
I am trying to scroll 2 panels at the same time. One panel has visible scroll bar.


The easiest way to do this is to have them share the same model:

 
Nike Smith
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob, Brian, thanks a lot!

Brian, your solution is exactly what I had been looking for.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I didn't even know that scroll bars had models as well. Well, guess I just learned something new
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!