Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane and 2 panels  RSS feed

 
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: 20893
81
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: 935
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: 20893
81
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!