Java tutorial
FileShortTitle:JavaFX VBox FileLongTitle:JavaFX VBox FileTag:Layout===SectionShortTitle:Description SectionLongTitle:Description SectionContent: <p>The VBox layout places child nodes stacked in a vertical column.</p> <p>The new added children are placed beneath the previous child node.</p> <p>By default the VBox honors the children'spreferred width and height.</p><p> When the parent node is not resizable,for example a Group node,the maximum vertical column'swidth is based on the node with the greatest preferred width.</p> <p>By default each child node aligns to the top-left(Pos.TOP_LEFT)position. </p>===SectionShortTitle:Example SectionLongTitle:Example SectionContent: <p>The following code sets a TextArea control to grow vertically when the parent VBox'sheight is resized:</p> <myPreCode>TextArea myTextArea=new TextArea();VBox.setHgrow(myTextArea,Priority.ALWAYS);</myPreCode> <myTogglePreCode> import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextArea; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { TextArea myTextArea = new TextArea(); VBox hbox = new VBox(); hbox.getChildren().add(myTextArea); VBox.setVgrow(myTextArea, Priority.ALWAYS); Scene scene = new Scene(hbox, 320, 112, Color.rgb(0, 0, 0, 0)); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } </myTogglePreCode><p>The code above generates the following result.</p><myImage src='longtutorial/JavaImage/JavaFX/JavaFX_VBox_Example.PNG'></myImage> === SectionShortTitle:Example 2 SectionLongTitle:Example 2 SectionContent: <p> The following code uses four rectangles to demonstrate the use of a VBox.</p>