I wanted to know if there was any "easy" way I can set the vertical scroll-bar to be "scrolled" a specific amount upon a button press, or really upon any event at all.
For example, I have an application which has a side bar and one of the options on the sidebar is Settings. Settings has sub items, and I wanted to add the functionality to click on one of the sub items and it will open the Settings page and automatically scroll down to that specific point on the page where that sub item is located.
To programmatically scroll a ScrollPane
vertically simply manipulate the vvalue
property. Here's the documentation of that property:
The current vertical scroll position of the ScrollPane. This value may be set by the application to scroll the view programatically. The ScrollPane will update this value whenever the viewport is scrolled or panned by the user. This value must always be within the range of
vmin
tovmax
. Whenvvalue
equalsvmin
, the contained node is positioned so that its layoutBoundsminY
is visible. Whenvvalue
equalsvmax
, the contained node is positioned so that its layoutBoundsmaxY
is visible. Whenvvalue
is betweenvmin
andvmax
, the contained node is positioned proportionally between layoutBoundsminY
and layoutBoundsmaxY
.