nailujed nailujed - 1 year ago 374
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download