Javatpoint Logo
Javatpoint Logo

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.


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)


The HBox class contains two constructors that are given below.

  1. new HBox() : create HBox layout with 0 spacing
  2. new Hbox(Double spacing) : create HBox layout with a spacing value


JavaFX HBox Output1

Example : Setting the space among the nodes.

JavaFX HBox Output2
Next TopicJavaFX VBox

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA