I have created a Stage from an AnchorPane and some children elements (the AnchorPane and its children have been created in Java Scene Builder) and the hierarchy is shown below:
The stage and the scene are of course created programmatically at program initialization. I want to also add programmatically a GridPane as a child of the ScrollPane shown in the image. In my program (the controller of the specific window) I can get a reference to the ScrollPane:
@FXML
private ScrollPane srcPaneUsers;
(the id srcPaneUsers has been given through the respective field of the properties windows of Scene Builder)
HOWEVER!!: When I try to add programmatically a new GridPane created at run-time through the following lines of the initialize method of the controller:
public void initialize(URL location, ResourceBundle resources) {
myGridPane = new GridPane();
srcPaneUsers.getChildren().add(myGridPane);
}
I get a compile time error that says "The method getChildren() from the type Parent is not visible." And so I cannot add my GridPane at run time. Any ideas?