Is it correct to have VBox populate the parent element:
final Group root = new Group(); final Scene scene = new Scene(root, 1000, 800, Color.BLACK); final VBox c = new VBox(); c.setAlignment(Pos.TOP_CENTER); c.setSpacing(10); c.setFillWidth(true); c.getChildren().add(...); c.getChildren().add(...); c.getChildren().add(...); c.prefWidthProperty().bind(scene.widthProperty()); c.prefHeightProperty().bind(scene.heightProperty()); root.getChildren().add(c); stage.setTitle("blah"); //$NON-NLS-1$ stage.setScene(scene); stage.show();
You can achieve the same functionality without using bind, using only BorderPane instead of Group
final BorderPane root = new BorderPane(); // construct your VBox root.setCenter(vbox);
You make a common mistake.
No need to create a group as a root, just use VBox as a root and add it to the scene.
final Scene scene = new Scene(c, 1000, 800, Color.BLACK);