Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GridPane

[99:7] extends: Pane

The GridPane class wraps the JavaFX GridPane layout container, which arranges child nodes in a flexible grid of rows and columns. Each child is placed in a specific cell using column and row index constraints, and cells can span multiple columns or rows. Column widths and row heights can be set to fixed, percentage, or grow-based sizes using ColumnConstraints and RowConstraints, making GridPane well suited for form layouts and complex structured UIs.

CSS Properties -- GridPane

Property Values Default Description
-fx-hgap <size> 0 Horizontal gap between columns.
-fx-vgap <size> 0 Vertical gap between rows.
-fx-alignment top-left | top-center | top-right | center-left | center | center-right | bottom-left | bottom-center | bottom-right | baseline-left | baseline-center | baseline-right top-left Alignment of the grid content within the GridPane.
-fx-grid-lines-visible <boolean> false When true, draws grid lines for debugging layout.

CSS Properties -- Region

Background fills

Property Values Default Description
-fx-background-color <paint> [, <paint>]* transparent One or more paint values for background fill layers, rendered back to front.
-fx-background-insets <size> or <t> <r> <b> <l> [, ...]* 0 0 0 0 Insets from the region edges for each background fill layer.
-fx-background-radius <size> [/ <size>]* [, ...]* 0 0 0 0 Corner radii for each background fill layer.

Background images

Property Values Default Description
-fx-background-image <uri> [, <uri>]* null One or more image URIs for background image layers.
-fx-background-position <bg-position> [, ...]* 0% 0% Position of each background image within the region. Accepts keywords or size values.
-fx-background-repeat <repeat-style> [, ...]* repeat repeat Tiling behavior for each background image. Values: repeat, no-repeat, round, space applied per axis.
-fx-background-size <bg-size> [, ...]* auto auto Dimensions for each background image. Supports cover, contain, stretch, or explicit sizes.

Stroked borders

Property Values Default Description
-fx-border-color <paint> or <t> <r> <b> <l> [, ...]* null Paint colors for the border stroke layers.
-fx-border-insets <size> or <t> <r> <b> <l> [, ...]* null Insets from region edges for each border layer.
-fx-border-radius <size> [, ...]* null Corner radii for border stroke layers.
-fx-border-style <border-style> [, ...]* null Border line style (solid, dotted, dashed) plus phase and line cap/join options per layer.
-fx-border-width <size> or <t> <r> <b> <l> [, ...]* null Thickness of each border stroke layer, per side.

Border images

Property Values Default Description
-fx-border-image-source <uri> [, <uri>]* null Image URIs used to paint the border.
-fx-border-image-insets <size> or <t> <r> <b> <l> [, ...]* 0 0 0 0 Insets for each border image layer.
-fx-border-image-repeat <repeat-style> [, ...]* repeat repeat Tiling behavior for each border image.
-fx-border-image-slice <size> or <t> <r> <b> <l> [fill] [, ...]* 100% Divides each border image into nine regions. Adding fill preserves the center region.
-fx-border-image-width <size> or <t> <r> <b> <l> [, ...]* 1 1 1 1 Width of each border image slice per side.

Other Region properties

Property Values Default Description
-fx-padding <size> or <t> <r> <b> <l> 0 0 0 0 Interior padding between the region border and its content.
-fx-shape <string> null SVG path string that defines a custom clip shape for the region.
-fx-scale-shape true | false true When true, the shape is scaled to fit the region.
-fx-position-shape true | false true When true, the shape is centered within the region.
-fx-snap-to-pixel true | false true When true, positions and sizes are rounded to whole pixel boundaries.
-fx-min-width <size> -1 Minimum width. -1 uses the computed minimum.
-fx-pref-width <size> -1 Preferred width. -1 uses the computed preferred.
-fx-max-width <size> -1 Maximum width. -1 uses the computed maximum.
-fx-min-height <size> -1 Minimum height. -1 uses the computed minimum.
-fx-pref-height <size> -1 Preferred height. -1 uses the computed preferred.
-fx-max-height <size> -1 Maximum height. -1 uses the computed maximum.

CSS Properties -- Node

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-cursor null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> null (inherits) Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-focus-traversable true | false false Whether this node participates in focus traversal via the keyboard Tab key.
-fx-view-order <number> 0 Adjusts rendering and hit-test order within the parent without changing the scene graph order.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point. Positive values are clockwise.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-scale-z <number> 1 Scale factor along the Z axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
-fx-translate-z <number> 0 Translation offset along the Z axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout. collapse removes it from layout; hidden keeps the space.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods

  • GridPane ()

    Constructor that creates the GridPane object.

    • @r this object
  • setHgap (double G)

    Sets the horizontal gap between columns.

    • @p G is a double with the gap in pixels.
    • @r this object
  • getHgap ()

    Returns the horizontal gap between columns.

    • @r A double with the gap in pixels.
  • hgapProperty ()

    Returns the DoubleProperty backing the horizontal gap.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setVgap (double G)

    Sets the vertical gap between rows.

    • @p G is a double with the gap in pixels.
    • @r this object
  • getVgap ()

    Returns the vertical gap between rows.

    • @r A double with the gap in pixels.
  • vgapProperty ()

    Returns the DoubleProperty backing the vertical gap.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setAlignment (string Align)

    Sets the overall alignment of grid content within the GridPane.

    • @p Align is a javafx.geometry.Pos constant name. Using an fxpos enum value such as fxpos.CENTER is recommended over the bare string "CENTER", though both work.
    • @r this object
  • getAlignment ()

    Returns the overall alignment of grid content.

    • @r An AJO wrapping javafx.geometry.Pos.
  • alignmentProperty ()

    Returns the ObjectProperty backing the alignment.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • setGridLinesVisible (bool Visible)

    Sets whether grid lines are visible. Used for layout debugging.

    • @p Visible is a bool; true draws debug grid lines.
    • @r this object
  • isGridLinesVisible ()

    Returns whether grid lines are visible.

    • @r A bool true when debug grid lines are drawn.
  • gridLinesVisibleProperty ()

    Returns the BooleanProperty backing the grid-lines-visible flag.

    • @r An AJO wrapping javafx.beans.property.BooleanProperty.
  • getRowConstraints ()

    Returns the ObservableList of RowConstraints applied to the grid rows.

    • @r An AJO wrapping ObservableList.
  • getColumnConstraints ()

    Returns the ObservableList of ColumnConstraints applied to the grid columns.

    • @r An AJO wrapping ObservableList.
  • add (object NodeObj, int Col, int Row)

    Adds a child node at the given column and row index.

    • @p NodeObj is the node wrapper to add.
    • @p Col is an int with the zero-based column index.
    • @p Row is an int with the zero-based row index.
    • @r this object
  • add5 (object NodeObj, int Col, int Row, int ColSpan, int RowSpan)

    Adds a child node at the given column and row index with explicit column and row spans. Mirrors the 5-argument JavaFX overload.

    • @p NodeObj is the node wrapper to add.
    • @p Col is an int with the zero-based column index.
    • @p Row is an int with the zero-based row index.
    • @p ColSpan is an int with the number of columns to span.
    • @p RowSpan is an int with the number of rows to span.
    • @r this object
  • addRow (int Row, list Nodes)

    Adds the given nodes as a single row at the specified row index.

    • @p Row is an int with the zero-based row index.
    • @p Nodes is a list of node wrappers to place left to right.
    • @r this object
  • addColumn (int Col, list Nodes)

    Adds the given nodes as a single column at the specified column index.

    • @p Col is an int with the zero-based column index.
    • @p Nodes is a list of node wrappers to place top to bottom.
    • @r this object
  • getRowCount ()

    Returns the number of rows currently in the grid.

    • @r An int with the row count.
  • getColumnCount ()

    Returns the number of columns currently in the grid.

    • @r An int with the column count.
  • getCellBounds (int Col, int Row)

    Returns the cell bounds for the given column and row.

    • @p Col is an int with the zero-based column index.
    • @p Row is an int with the zero-based row index.
    • @r An AJO wrapping javafx.geometry.Bounds for the cell.
  • setColumnIndex (NodeObj, int Col)

    Sets the column index of a child within the grid. This wraps the static JavaFX method GridPane.setColumnIndex(Node, Integer).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Col is an int with the zero-based column index.
    • @r this object for chaining
  • getColumnIndex (NodeObj)

    Returns the column index set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An int with the column index, or null.
  • setRowIndex (NodeObj, int Row)

    Sets the row index of a child within the grid. This wraps the static JavaFX method GridPane.setRowIndex(Node, Integer).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Row is an int with the zero-based row index.
    • @r this object for chaining
  • getRowIndex (NodeObj)

    Returns the row index set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An int with the row index, or null.
  • setColumnSpan (NodeObj, int Span)

    Sets the number of columns a child spans. This wraps the static JavaFX method GridPane.setColumnSpan(Node, Integer).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Span is an int with the number of columns to span.
    • @r this object for chaining
  • getColumnSpan (NodeObj)

    Returns the column span set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An int with the column span, or null.
  • setRowSpan (NodeObj, int Span)

    Sets the number of rows a child spans. This wraps the static JavaFX method GridPane.setRowSpan(Node, Integer).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Span is an int with the number of rows to span.
    • @r this object for chaining
  • getRowSpan (NodeObj)

    Returns the row span set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An int with the row span, or null.
  • setHalignment (NodeObj, string Halignment)

    Sets the horizontal alignment of a child within its grid cell. This wraps the static JavaFX method GridPane.setHalignment(Node, HPos).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Halignment is a javafx.geometry.HPos constant name: LEFT, CENTER, or RIGHT.
    • @r this object for chaining
  • getHalignment (NodeObj)

    Returns the horizontal cell alignment set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An AJO around the javafx.geometry.HPos value, or null.
  • setValignment (NodeObj, string Valignment)

    Sets the vertical alignment of a child within its grid cell. This wraps the static JavaFX method GridPane.setValignment(Node, VPos).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Valignment is a javafx.geometry.VPos constant name: TOP, CENTER, BASELINE, or BOTTOM.
    • @r this object for chaining
  • getValignment (NodeObj)

    Returns the vertical cell alignment set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An AJO around the javafx.geometry.VPos value, or null.
  • setHgrow (NodeObj, string Priority)

    Sets the horizontal grow priority of a child within the grid. This wraps the static JavaFX method GridPane.setHgrow(Node, Priority).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Priority is a javafx.scene.layout.Priority constant name: ALWAYS, SOMETIMES, or NEVER.
    • @r this object for chaining
  • getHgrow (NodeObj)

    Returns the horizontal grow priority set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An AJO around the javafx.scene.layout.Priority value, or null.
  • setVgrow (NodeObj, string Priority)

    Sets the vertical grow priority of a child within the grid. This wraps the static JavaFX method GridPane.setVgrow(Node, Priority).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Priority is a javafx.scene.layout.Priority constant name: ALWAYS, SOMETIMES, or NEVER.
    • @r this object for chaining
  • getVgrow (NodeObj)

    Returns the vertical grow priority set on a child, or null when none is set.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An AJO around the javafx.scene.layout.Priority value, or null.
  • setFillWidth (NodeObj, bool Fill)

    Sets whether a child fills the width of its grid cell. This wraps the static JavaFX method GridPane.setFillWidth(Node, Boolean).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Fill is a bool; true makes the child fill its cell width.
    • @r this object for chaining
  • isFillWidth (NodeObj)

    Returns whether a child is set to fill the width of its cell, or null when unset.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r A bool, or null when no fill-width constraint is set.
  • setFillHeight (NodeObj, bool Fill)

    Sets whether a child fills the height of its grid cell. This wraps the static JavaFX method GridPane.setFillHeight(Node, Boolean).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Fill is a bool; true makes the child fill its cell height.
    • @r this object for chaining
  • isFillHeight (NodeObj)

    Returns whether a child is set to fill the height of its cell, or null when unset.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r A bool, or null when no fill-height constraint is set.
  • setMargin (NodeObj, double Top, double Right, double Bottom, double Left)

    Sets the margin space around a child of this GridPane. This wraps the static JavaFX method GridPane.setMargin(Node, Insets), building the Insets from the four edge values.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @p Top is a double with the top margin in pixels.
    • @p Right is a double with the right margin in pixels.
    • @p Bottom is a double with the bottom margin in pixels.
    • @p Left is a double with the left margin in pixels.
    • @r this object for chaining
  • getMargin (NodeObj)

    Returns the margin Insets set on a child of this GridPane.

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r An AJO around the javafx.geometry.Insets, or null when no margin is set.
  • clearConstraints (NodeObj)

    Removes all GridPane layout constraints from a child (indices, spans, alignment, grow, fill, and margin). This wraps the static JavaFX method GridPane.clearConstraints(Node).

    • @p NodeObj is the child node, either an Aussom wrapper or a raw AJO.
    • @r this object for chaining
  • setConstraints (NodeObj, int Col, int Row, int ColSpan = 1, int RowSpan = 1, string HAlign = null, string VAlign = null, string HGrow = null, string VGrow = null)

    Sets a child's column, row, spans, and alignment/grow in one call. This wraps the static JavaFX method GridPane.setConstraints. The individual constraint setters (setColumnIndex, setRowIndex, and so on) remain available for setting one value at a time.

    • @p NodeObj is the child node, either a wrapper or a raw AJO.
    • @p Col is an int with the column index.
    • @p Row is an int with the row index.
    • @p ColSpan is an optional int with the column span (default 1).
    • @p RowSpan is an optional int with the row span (default 1).
    • @p HAlign is an optional javafx.geometry.HPos constant name (LEFT, CENTER, RIGHT), or null to leave it unset.
    • @p VAlign is an optional javafx.geometry.VPos constant name (TOP, CENTER, BASELINE, BOTTOM), or null to leave it unset.
    • @p HGrow is an optional javafx.scene.layout.Priority constant name (ALWAYS, SOMETIMES, NEVER), or null to leave it unset.
    • @p VGrow is an optional javafx.scene.layout.Priority constant name, or null to leave it unset.
    • @r this object for chaining