I am trying to add a group contains several MeshViews that were read from a file to the center of a borderlayout. I am using a FXML file to define the layout. I have given the center AnchorPane an fx:id "centerPane" and the group containing the MeshViews a fx:id "centerGroup". I do not get any errors, but nothing appears on the screen in the center pane. I was doing a similar thing when I first started where I manually created a meshview and it would appear in the center pane (but then I was using the setCenter method of the borderpane object (which I had also assigned an fx:id name to so I could access it from within the controller code. I will include the fxml portion and lines from controller below that are directly involved. If someone could help me figure out how to get the meshviews to appear I would really appreciate the help. I've read most of a JavaFX book and for some reason still struggle with this. Thanks.
From the FXML file:
<center>
<VBox prefHeight="400.0" prefWidth="640.0">
<children>
<AnchorPane fx:id="centerPane" maxHeight="-1.0" maxWidth="-1.0"
prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
<children>
<Group fx:id="centerGroup" />
</children>
</AnchorPane>
</children>
</VBox>
</center>
Lines from controller file:
@FXML
private AnchorPane centerPane;
@FXML
private Group centerGroup;
(inside of a for loop I add the meshviews from an array list into the group)
for( - ; - ; - ){
centerGroup.getChildren().add(meshViews[i]);
}
PerspectiveCamera camera = new PerspectiveCamera(false);
PointLight redLight = new PointLight();
redLight.setColor(Color.RED);
PointLight greenLight = new PointLight();
greenLight.setColor(Color.GREEN);
( I have tried all three below. middle one gave duplicate child error. )
//borderPane.setCenter(centerGroup);
//centerPane.getChildren().addAll(centerGroup, redLight, greenLight);
centerPane.getChildren().addAll(redLight, greenLight);
I believe that is enough code to paint a picture of what I am trying to fix. I will attach a picture of the gui to show that while the code runs and I am printout out to the console the number of meshviews read from the file and the number is correct, nothing appears on the screen. Thanks for your help.