65
JavaFX HBox
HBox layout pane arranges the nodes in a single row. It is represented by javafx.scene.layout.HBox class. We just need to instantiate HBox class in order to create HBox layout.
Properties
The Properties of the class along with their setter methods are given in the table below.
Property | Description | Setter Methods |
---|---|---|
alignment | This represents the alignment of the nodes. | setAlignment(Double) |
fillHeight | This is a boolean property. If you set this property to true the height of the nodes will become equal to the height of the HBox. | setFillHeight(Double) |
spacing | This represents the space between the nodes in the HBox. It is of double type. | setSpacing(Double) |
Constructors
The HBox class contains two constructors that are given below.
- new HBox() : create HBox layout with 0 spacing
- new Hbox(Double spacing) : create HBox layout with a spacing value
Example
Example : Setting the space among the nodes.
Next TopicJavaFX VBox