Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mirroring JScrollBars

 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application in which I need to have one vertical JScrollBar mirror another when moved... (e.g. if I scroll the first scroll bar, the second will scroll the same amount and direction.). I have tried to set the scroll bars value but am unable to specify a value for the bar to start at (and yes, it is between the min and max). My first step is to be able to specify the starting value of a scroll bar ... say, setting it to the middle of the bar... any suggestions?
Thanks in advance.
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An addendum to my earlier post ... I can get this to work with simple scroll bars but for some reason I cannot do it with scroll bars extracted from a JScrollPane ... any ideas?
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could really use some help with this one. Nothing I try works ... going through the JViewport and setting position, trying to set it on the JScrollBar ... nothing will allow the vertical scrollbar to be set. I have been able to set the horizontal, but that is only half my problem (and the solution to that part still does not do anything to the vertical).
Please help, this is getting really frustrating!
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,
Is this what you are trying to do?

Enjoy,
Manfred.
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Close ... I want to do something similar with a JScrollPane (or the scrollbars in a JScrollPane). I was able figured out how to do it with normal scroll bars, but I cannot get it to work with scroll bars from a scroll pane.
What I need is the opposite of your example, basically ... I need the scroll bar to control the scrollbar in the scroll pane.
[This message has been edited by Chris Stehno (edited July 24, 2001).]
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I'll be damned! Something you showed me made it work ... I guess I just had the wrong approach. Thanks!
 
Josh Rehman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I just wished to share that I like the style of your code, Manfred.
Originally posted by Manfred Leonhardt:
[B]Hi Chris,
Is this what you are trying to do?

Enjoy,
Manfred.[/B]


------------------
--
JavaJosh | | mailto://joshjava@yahoo.com | | <A HREF="http://joshbrain.tripod.com<br /> icq:" TARGET=_blank>http://joshbrain.tripod.com
icq: 457 9276 "Never neglect the fundamentals." Toshiro Kageyama
Good Java References´┐Ż: <A HREF="http://www.javaranch.com/index.html<br /> " TARGET=_blank>http://www.javaranch.com/index.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic