Overview
This container uses a flexible Grid layout algorithm to position and size its children. Creating a new Grid is as easy as constructing an instance, adding in a list of Rows, and populating whatever Nodes you want to display.
Reasonable defaults are provided for most of the common JavaFX components, but for more control you can wrap Nodes in Cell objects and set various constraints such as grow, span, and preferred dimensions.
Here is a sample Grid to create a form:
Grid {
rows: [
row([Text {content: "Username:"}, TextBox {}]),
row([Text {content: "Password:"}, TextBox {}]),
row([Cell {content: TextBox {}, hspan: 2}])
]
}
For more information about using Grids, please refer to the test examples in the JavaFX source code, or see my blog: http://steveonjava.wordpress.com/
Profile: desktop
Variable Summary
| access | name | type | Can Read | Can Init | Can Write | Default Value | description |
|---|---|---|---|---|---|---|---|
| public | border | Number | ![]() | ![]() | ![]() |
The size of the border that will be placed around this Grid.
The size of the border that will be placed around this Grid. The border is both empty and transparent. Set this to 0 to remove the border. |
|
| public | growColumns | Number[] | ![]() | ![]() | ![]() |
A decimal value between 0 and 1 that designates the percentage of space the column with the matching index will consume of any available space in the container.
A decimal value between 0 and 1 that designates the percentage of space the column with the matching index will consume of any available space in the container. If the total amount of grow values exceeds 100% (1.0), then the whole area will be filled proportionally by percentage. If the total amount of grow values is less than 100%, then the remaining amount will be empty. |
|
| public | growRows | Number[] | ![]() | ![]() | ![]() |
A decimal value between 0 and 1 that designates the percentage of space the row with the matching index will consume of any available space in the container.
A decimal value between 0 and 1 that designates the percentage of space the row with the matching index will consume of any available space in the container. If the total amount of grow values exceeds 100% (1.0), then the whole area will be filled proportionally by percentage. If the total amount of grow values is less than 100%, then the remaining amount will be empty. |
|
| public | hgap | Number | ![]() | ![]() | ![]() |
The width of the horizontal gaps between cells.
The width of the horizontal gaps between cells. This can be set to zero to have cells flush against each other. |
|
| public | nodeHPos | HPos | ![]() | ![]() | ![]() | HPos.LEFT |
The horizontal position of each node within the Grid cell.
The horizontal position of each node within the Grid cell. This may be overridden for individual nodes by setting the hpos variable on the node's layoutInfo variable. HPos.LEFT |
| public | nodeVPos | VPos | ![]() | ![]() | ![]() | VPos.CENTER |
The vertical position of each node within the Grid cell.
The vertical position of each node within the Grid cell. This may be overridden for individual nodes by setting the vpos variable on the node's layoutInfo variable. VPos.CENTER |
| public | rows | Row[] | ![]() | ![]() | ![]() | ||
| public | vgap | Number | ![]() | ![]() | ![]() |
The width of the vertical gaps between cells.
The width of the vertical gaps between cells. This can be set to zero to have cells flush against each other. |
Inherited Variables
org.jfxtras.scene.layout.DefaultLayout
| access | name | type | Can Read | Can Init | Can Write | Default Value | description |
|---|---|---|---|---|---|---|---|
| public-read protected | defaultLayoutInfo | LayoutInfoBase | ![]() | subclass | subclass |
The default layout info for this Node.
The default layout info for this Node. Usually this will be initialized by the Node subclass to a static LayoutInfo for all instances. Any values set on this will override the default Constraint values. |

