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 bind
the ScrollPane
vvalue
property with the heightProperty
of the inner container. For example, if you have a VBox
in your ScrollPane
:
scrollPane.vvalueProperty().bind(vBox.heightProperty());
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With