title: Javafx : test with a layout manager?
body: <p>I'm learning javafx and I made few try with the vbox layout manager. The code seems to be ok but I wanna check if I really understood how it works.</p>
  
  <p>Here is the code :</p>
  
  <pre><code>public class TestShape2 extends Application {
  
    public static void main(String[] args) {
        launch(args);
    }
  
    @Override
    public void start(Stage primaryStage) throws Exception {
        Group root = new Group();
        Label topLabel = new Label("Top...");
        Label topLabel2 = new Label("Top 2...");
        Rectangle rect = new Rectangle();
  
        rect.setFill(Color.AQUA);
        Label bottomLabel = new Label("Bottom...");
  
        VBox vBox = new VBox();
        rect.widthProperty().bind(vBox.widthProperty());
        rect.heightProperty().bind(vBox.heightProperty());
  
        vBox.getChildren().addAll(topLabel, topLabel2, rect, bottomLabel);
        /*
         * Code 1
         */
        root.getChildren().add(vBox);
        Scene scene = new Scene(root, 300, 300, Color.BLANCHEDALMOND);
  
        /*
         * Code 2
         */
        // Scene scene = new Scene (vBox, 300, 300, Color.BLANCHEDALMOND);
  
        primaryStage.setScene(scene);
        primaryStage.show();
  
    }
  
  }
  </code></pre>
  
  <p>In the "code 1" : does the width and height of the vBox are those of the elements contained in the root ass the root group is the parent of the vbox ? And so, the vBox don't fill the whole space ?
  In the "code 2" : as I don't use some root group, the vbox dimensions will be the ones of the scene as the scene is the parent of the vbox ? 
  Does my understanding is correct ?</p>
  
  <p>If that's correct, my question is : what would be the code to have a "top label", a "bottom label" and a rectangle that would fill all the free space ? In the code 2, I never see the bottom label" as it seems the rectangle height is the height of the scene so, I suppose the bottom label is out of the scene. But how to solve that ?</p>
  
  <p>Thank you all for your help in understanding javafx</p>