nailujed nailujed - 8 months ago 179
Java Question

JavaFX auto-scroll down scrollpane

Is there any way of auto scroll down a ScrollPane control when it content's height increases ?
For example, I have a TitledPane on the bottom of the screen (inside a ScrollPane) and when I expand it I would like the ScrollPane to scroll down so I can see the entire content of the TitledPane.


You can achieve that behaviour With combination of titledPane.localToScene() and scrollPane.setVvalue()

The first is to get titledPane's coordinates while the second is to set scrollPane's vertical bar position. Note that it's range is between 0 - 1.