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

setHorizontalScrollBar and setVerticalScrollBar for ScrollPane?  RSS feed

 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, the subject pretty much says it all.

I know that JScrollPane has those two methods, setHorizontalScrollBar and setVerticalScrollBar, so that you can assign any arbitrary scrollbar to control the position of the viewport, but does ScrollPane have a handy, convenient way of doing the same?

Or is the only option to never show the ScrollPane's own scrollbars, and create separate ones that are checked to re-position the contents of the ScrollPane?

Thanks...
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
checked to re-position the contents of the ScrollPane
The ScrollPane api has methods you can use to programatically control the scrollbars and to get to the underlying Adjustable to make changes or get information.
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, that's how I wound up coding it. I went with never showing the ScrollPane's own scrollbars, creating a vertical and horizontal of my own, then implementing AdjustmentListener.

I just thought it looked awkward, not to mention that it made me grumpy, and was hoping that maybe I was overlooked something simpler.
[ December 01, 2006: Message edited by: Joe Vahabzadeh ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
was hoping that maybe I was overlooked something simpler.
A simpler approach would be to keep the original scrollbars and use api methods to control them.
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that possible for a layout somewhat like this:



where the scrollbars will only adjust the section labeled scroll pane, and nothing else? This is basically the constraint I have to work within.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. I think you did well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!