APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.layout

public Class RowConstraints

extends ConstraintsBase
Class Inheritance
Static Imports
javafx.scene.layout.Region.USE_COMPUTED_SIZE, .Region.USE_PREF_SIZE

Defines optional layout constraints for a row in a GridPane. If a RowConstraints object is added for a row in a gridpane, the gridpane will use those constraint values when computing the row's height and layout.

For example, to create a GridPane with 10 rows 50 pixels tall:

GridPane gridpane = new GridPane();
    for (int i = 0; i < 10; i++) {
        RowConstraints row = new RowConstraints(50);
        gridpane.getRowConstraints().add(row);
    }
Or, to create a GridPane where rows take 25%, 50%, 25% of its height:
GridPane gridpane = new GridPane();
    RowConstraints row1 = new RowConstraints();
    row1.setPercentHeight(25);
    RowConstraints row2 = new RowConstraints();
    row2.setPercentHeight(50);
    RowConstraints row3 = new RowConstraints();
    row3.setPercentHeight(25);
    gridpane.getRowConstraints().addAll(row1,row2,row3);
Note that adding an empty RowConstraints object has the effect of not setting any constraints, leaving the GridPane to compute the row's layout based solely on its content's size preferences and constraints.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private BooleanProperty
fillHeight

The vertical fill policy for the row.

private DoubleProperty
maxHeight

The maximum height for the row.

private DoubleProperty
minHeight

The minimum height for the row.

private DoubleProperty
percentHeight

The height percentage of the row.

private DoubleProperty
prefHeight

The preferred height for the row.

private ObjectProperty<VPos>
valignment

The vertical alignment for the row.

private ObjectProperty<Priority>
vgrow

The vertical grow priority for the row.

Inherited from javafx.scene.layout.ConstraintsBase:
CONSTRAIN_TO_PREF

Constructor Summary

AccessConstructor and Description
public
RowConstraints()

Creates a row constraints object with no properties set.

public
RowConstraints(double
the height of the row
height
)

Creates a row constraint object with a fixed height.

public
RowConstraints(double
the minimum height
minHeight
,
double
the preferred height
prefHeight
,
double
the maximum height
maxHeight
)

Creates a row constraint object with a fixed size range.

public
RowConstraints(double
the minimum height
minHeight
,
double
the preferred height
prefHeight
,
double
the maximum height
maxHeight
,
Priority
the vertical grow priority
vgrow
,
VPos
the vertical alignment
valignment
,
boolean
the vertical fill behavior
fillHeight
)

Creates a row constraint object with a fixed size range, vertical grow priority, vertical alignment, and vertical fill behavior.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty
public final double
public final double
public final double
public final double
public final VPos
public final Priority
public final boolean
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final DoubleProperty
public final void
setFillHeight(boolean value)

public final void
setMaxHeight(double value)

public final void
setMinHeight(double value)

public final void
setPercentHeight(double value)

public final void
setPrefHeight(double value)

public final void
public final void
public String

Returns:

a string representation of this RowConstraints object.
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this RowConstraints object.

public final ObjectProperty<VPos>
public final ObjectProperty<Priority>
Inherited from javafx.scene.layout.ConstraintsBase:
addremoverequestLayout

Field Detail

fillHeightback to summary
private BooleanProperty fillHeight

The vertical fill policy for the row. The gridpane will use this property to determine whether nodes contained within the row should be expanded to fill the row's height or kept to their preferred heights.

The default value is true.

maxHeightback to summary
private DoubleProperty maxHeight

The maximum height for the row. This property is ignored if percentHeight is set.

The default value is USE_COMPUTED_SIZE, which means the maximum height will be computed to be the smallest maximum height of the row's content.

minHeightback to summary
private DoubleProperty minHeight

The minimum height for the row. This property is ignored if percentHeight is set.

The default value is USE_COMPUTED_SIZE, which means the minimum height will be computed to be the largest minimum height of the row's content.

percentHeightback to summary
private DoubleProperty percentHeight

The height percentage of the row. If set to a value greater than 0, the row will be resized to that percentage of the available gridpane height and the other size constraints (minHeight, prefHeight, maxHeight, vgrow) will be ignored. The default value is -1, which means the percentage will be ignored.

prefHeightback to summary
private DoubleProperty prefHeight

The preferred height for the row. This property is ignored if percentHeight is set.

The default value is USE_COMPUTED_SIZE, which means the preferred height will be computed to be the largest preferred height of the row's content.

valignmentback to summary
private ObjectProperty<VPos> valignment

The vertical alignment for the row. If set, will be the default vertical alignment for nodes contained within the row. If this property is set to VPos.BASELINE, then the fillHeight property will be ignored and nodes will always be resized to their preferred heights.

vgrowback to summary
private ObjectProperty<Priority> vgrow

The vertical grow priority for the row. If set, the gridpane will use this priority to determine whether the row should be given any additional height if the gridpane is resized larger than its preferred height. This property is ignored if percentHeight is set.

This default value is null, which means that the row's grow priority will be derived from largest grow priority set on a content node.

Constructor Detail

RowConstraintsback to summary
public RowConstraints()

Creates a row constraints object with no properties set.

RowConstraintsback to summary
public RowConstraints(double height)

Creates a row constraint object with a fixed height. This is a convenience for setting the preferred height constraint to the fixed value and the minHeight and maxHeight constraints to the USE_PREF_SIZE flag to ensure the row is always that height.

Parameters
height:double

the height of the row

RowConstraintsback to summary
public RowConstraints(double minHeight, double prefHeight, double maxHeight)

Creates a row constraint object with a fixed size range. This is a convenience for setting the minimum, preferred, and maximum height constraints.

Parameters
minHeight:double

the minimum height

prefHeight:double

the preferred height

maxHeight:double

the maximum height

RowConstraintsback to summary
public RowConstraints(double minHeight, double prefHeight, double maxHeight, Priority vgrow, VPos valignment, boolean fillHeight)

Creates a row constraint object with a fixed size range, vertical grow priority, vertical alignment, and vertical fill behavior.

Parameters
minHeight:double

the minimum height

prefHeight:double

the preferred height

maxHeight:double

the maximum height

vgrow:Priority

the vertical grow priority

valignment:VPos

the vertical alignment

fillHeight:boolean

the vertical fill behavior

Method Detail

fillHeightPropertyback to summary
public final BooleanProperty fillHeightProperty()
getMaxHeightback to summary
public final double getMaxHeight()
getMinHeightback to summary
public final double getMinHeight()
getPercentHeightback to summary
public final double getPercentHeight()
getPrefHeightback to summary
public final double getPrefHeight()
getValignmentback to summary
public final VPos getValignment()
getVgrowback to summary
public final Priority getVgrow()
isFillHeightback to summary
public final boolean isFillHeight()
maxHeightPropertyback to summary
public final DoubleProperty maxHeightProperty()
minHeightPropertyback to summary
public final DoubleProperty minHeightProperty()
percentHeightPropertyback to summary
public final DoubleProperty percentHeightProperty()
prefHeightPropertyback to summary
public final DoubleProperty prefHeightProperty()
setFillHeightback to summary
public final void setFillHeight(boolean value)
setMaxHeightback to summary
public final void setMaxHeight(double value)
setMinHeightback to summary
public final void setMinHeight(double value)
setPercentHeightback to summary
public final void setPercentHeight(double value)
setPrefHeightback to summary
public final void setPrefHeight(double value)
setValignmentback to summary
public final void setValignment(VPos value)
setVgrowback to summary
public final void setVgrow(Priority value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this RowConstraints object.

Returns:String

a string representation of this RowConstraints object.

Annotations
@Override
valignmentPropertyback to summary
public final ObjectProperty<VPos> valignmentProperty()
vgrowPropertyback to summary
public final ObjectProperty<Priority> vgrowProperty()