If you need to add to the VBox from some random class:
- give an
fx:id
to the VBox, say"vbox"
- create a Controller for the view and associate it to the view in the FXML
- in the Controller, add a
@FXML VBox vbox;
(wherevbox
it the same as thefx:id
) - retrieve the controller from the FXMLLoader and access the VBox:
controller.vbox;
.
If you just need to add something to the VBox when your view is loaded, follow 1 to 3 above and add the relevant code in the initialize method of the Controller.