Home » JavaFX VBox

JavaFX VBox

Instead of arranging the nodes in horizontal row, Vbox Layout Pane arranges the nodes in a single vertical column. It is represented by javafx.scene.layout.VBox class which provides all the methods to deal with the styling and the distance among the nodes. This class needs to be instantiated in order to implement VBox layout in our application.

Properties

This Method Provides various properties which are described in the table below.

Property Description Setter Methods
Alignment This property is for the alignment of the nodes. setAlignement(Double)
FillWidth This property is of the boolean type. The Widtht of resizeable nodes can be made equal to the Width of the VBox by setting this property to true. setFillWidth(boolean)
Spacing This property is to set some spacing among the nodes of VBox. setSpacing(Double)

Constructors

  1. VBox() : creates layout with 0 spacing
  2. Vbox(Double spacing) : creates layout with a spacing value of double type
  3. Vbox(Double spacing, Node? children) : creates a layout with the specified spacing among the specified child nodes
  4. Vbox(Node? children) : creates a layout with the specified nodes having 0 spacing among them

Example

Output:

JavaFX VBox output

Next TopicJavaFX StackPane

You may also like