I want to set the hValue of a ScrollPane to 1.0, which is the hmax value, at the initialization, but the hValue is automatically set to 0.0, before the scrollpane is displayed. How can I initialize a scrollpane with the hmax value, after adding content to it? I tried it already by setting the values in the fxml file, but at the beginning the hvalue is always 0.0.
0
votes
1 Answers
0
votes
If you are using SceneBuilder you can edit the Hvalue of the ScrollPane under the properties tab on the right side of the application. Also, if you are using SceneBuilder make sure your FX-IDs are aligned. You shouldn't need to write any code inside your
public void initialize(URL location, ResourceBundle resources) {
}
Adding content to it shouldn't matter, you can still change the Hvalue of the ScrollPane. I'm also pretty sure that initialize is called after the FXMLLoader located in your start method.
Parent root = FXMLLoader.load(getClass().getResource("GUILayout.fxml"));
From my experience I've used the initialize method to set the text value on certain buttons or labels that aren't constant and to load a file. It shouldn't be used to change any dimensions of your nodes to a constant.