How to set vbox size to window size in javafx


I am using JavaFX for UI.How to set Vbox layout's size to window size?
I tried the below code,but couldnot view the components added in vbox.

    VBox vbox = new VBox();    vbox.setPadding(new Insets(10, 10, 10, 10));      vbox.setSpacing(10);

Best Solution

This sets VBOX on 80% of the Stage width:

Stage window = PrimaryStage;VBox layout = new VBox(10);//multiply to set size (0.80 is like 80% of the window)layout.prefWidthProperty().bind(window.widthProperty().multiply(0.80));