JavaFX GridPane

GridPane Layout pane allows us to add the multiple nodes in multiple rows and columns. It is seen as a flexible grid of rows and columns where nodes can be placed in any cell of the grid. It is represented by javafx.scence.layout.GridPane class. We just need to instantiate this class to implement GridPane.

Properties

The properties of the class along with their setter methods are given in the table below.

Property Description Setter Methods
alignment Represents the alignment of the grid within the GridPane. setAlignment(Pos value)
gridLinesVisible This property is intended for debugging. Lines can be displayed to show the gidpane's rows and columns by setting this property to true. setGridLinesVisible(Boolean value)
hgap Horizontal gaps among the columns setHgap(Double value)
vgap Vertical gaps among the rows setVgap(Double value)

Constructors

The class contains only one constructor that is given below.

  • Public GridPane(): creates a gridpane with 0 hgap/vgap.

Example:

Output:


JavaFX GridPane output
Next TopicJavaFX FlowPane




Contact US

Email:[email protected]

JavaFX GridPane
10/30