Spec-Zone.ru › OpenJavaFX 8
javafx.scene.layout

Class RowConstraints

java.lang.Object
  • javafx.scene.layout.ConstraintsBase
    • javafx.scene.layout.RowConstraints


public class RowConstraints
extends ConstraintsBase
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 width:
GridPane gridpane = new GridPane();
     RowConstraints row1 = new RowConstraints();
     row1.setPercentWidth(25);
     RowConstraints row2 = new RowConstraints();
     row2.setPercentWidth(50);
     RowConstraints row3 = new RowConstraints();
     row3.setPercentWidth(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

  • Property Summary

    All MethodsInstance MethodsConcrete Methods
    Type Property and Description
    BooleanProperty fillHeight
    The vertical fill policy for the row.
    DoubleProperty maxHeight
    The maximum height for the row.
    DoubleProperty minHeight
    The minimum height for the row.
    DoubleProperty percentHeight
    The height percentage of the row.
    DoubleProperty prefHeight
    The preferred height for the row.
    ObjectProperty<VPos> valignment
    The vertical alignment for the row.
    ObjectProperty<Priority> vgrow
    The vertical grow priority for the row.
  • Field Summary

    • Fields inherited from class javafx.scene.layout.ConstraintsBase

      CONSTRAIN_TO_PREF
  • Constructor Summary

    Constructors
    Constructor and Description
    RowConstraints()
    Creates a row constraints object with no properties set.
    RowConstraints(double height)
    Creates a row constraint object with a fixed height.
    RowConstraints(double minHeight, double prefHeight, double maxHeight)
    Creates a row constraint object with a fixed size range.
    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.
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    BooleanProperty fillHeightProperty()
    The vertical fill policy for the row.
    double getMaxHeight()
    Gets the value of the property maxHeight.
    double getMinHeight()
    Gets the value of the property minHeight.
    double getPercentHeight()
    Gets the value of the property percentHeight.
    double getPrefHeight()
    Gets the value of the property prefHeight.
    VPos getValignment()
    Gets the value of the property valignment.
    Priority getVgrow()
    Gets the value of the property vgrow.
    boolean isFillHeight()
    Gets the value of the property fillHeight.
    DoubleProperty maxHeightProperty()
    The maximum height for the row.
    DoubleProperty minHeightProperty()
    The minimum height for the row.
    DoubleProperty percentHeightProperty()
    The height percentage of the row.
    DoubleProperty prefHeightProperty()
    The preferred height for the row.
    void setFillHeight(boolean value)
    Sets the value of the property fillHeight.
    void setMaxHeight(double value)
    Sets the value of the property maxHeight.
    void setMinHeight(double value)
    Sets the value of the property minHeight.
    void setPercentHeight(double value)
    Sets the value of the property percentHeight.
    void setPrefHeight(double value)
    Sets the value of the property prefHeight.
    void setValignment(VPos value)
    Sets the value of the property valignment.
    void setVgrow(Priority value)
    Sets the value of the property vgrow.
    String toString()
    Returns a string representation of this RowConstraints object.
    ObjectProperty<VPos> valignmentProperty()
    The vertical alignment for the row.
    ObjectProperty<Priority> vgrowProperty()
    The vertical grow priority for the row.
    • Methods inherited from class javafx.scene.layout.ConstraintsBase

      requestLayout
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Property Detail

    • minHeight

      public final DoubleProperty minHeightProperty
      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.

      See Also:

      getMinHeight(), setMinHeight(double)

    • prefHeight

      public final DoubleProperty prefHeightProperty
      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.

      See Also:

      getPrefHeight(), setPrefHeight(double)

    • maxHeight

      public final DoubleProperty maxHeightProperty
      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.

      See Also:

      getMaxHeight(), setMaxHeight(double)

    • percentHeight

      public final DoubleProperty percentHeightProperty
      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.

      See Also:

      getPercentHeight(), setPercentHeight(double)

    • vgrow

      public final ObjectProperty<Priority> vgrowProperty
      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.

      See Also:

      getVgrow(), setVgrow(Priority)

    • valignment

      public final ObjectProperty<VPos> valignmentProperty
      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.

      See Also:

      getValignment(), setValignment(VPos)

    • fillHeight

      public final BooleanProperty fillHeightProperty
      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.

      See Also:

      isFillHeight(), setFillHeight(boolean)

  • Constructor Detail

    • RowConstraints

      public RowConstraints()
      Creates a row constraints object with no properties set.
    • RowConstraints

      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 - the height of the row

    • RowConstraints

      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.
    • RowConstraints

      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.
  • Method Detail

    • setMinHeight

      public final void setMinHeight(double value)
      Sets the value of the property minHeight.

      Property description:

      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.

    • getMinHeight

      public final double getMinHeight()
      Gets the value of the property minHeight.

      Property description:

      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.

    • minHeightProperty

      public final DoubleProperty minHeightProperty()
      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.

      See Also:

      getMinHeight(), setMinHeight(double)

    • setPrefHeight

      public final void setPrefHeight(double value)
      Sets the value of the property prefHeight.

      Property description:

      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.

    • getPrefHeight

      public final double getPrefHeight()
      Gets the value of the property prefHeight.

      Property description:

      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.

    • prefHeightProperty

      public final DoubleProperty prefHeightProperty()
      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.

      See Also:

      getPrefHeight(), setPrefHeight(double)

    • setMaxHeight

      public final void setMaxHeight(double value)
      Sets the value of the property maxHeight.

      Property description:

      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.

    • getMaxHeight

      public final double getMaxHeight()
      Gets the value of the property maxHeight.

      Property description:

      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.

    • maxHeightProperty

      public final DoubleProperty maxHeightProperty()
      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.

      See Also:

      getMaxHeight(), setMaxHeight(double)

    • setPercentHeight

      public final void setPercentHeight(double value)
      Sets the value of the property percentHeight.

      Property description:

      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.

    • getPercentHeight

      public final double getPercentHeight()
      Gets the value of the property percentHeight.

      Property description:

      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.

    • percentHeightProperty

      public final DoubleProperty percentHeightProperty()
      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.

      See Also:

      getPercentHeight(), setPercentHeight(double)

    • setVgrow

      public final void setVgrow(Priority value)
      Sets the value of the property vgrow.

      Property description:

      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.

    • getVgrow

      public final Priority getVgrow()
      Gets the value of the property vgrow.

      Property description:

      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.

    • vgrowProperty

      public final ObjectProperty<Priority> vgrowProperty()
      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.

      See Also:

      getVgrow(), setVgrow(Priority)

    • setValignment

      public final void setValignment(VPos value)
      Sets the value of the property valignment.

      Property description:

      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.

    • getValignment

      public final VPos getValignment()
      Gets the value of the property valignment.

      Property description:

      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.

    • valignmentProperty

      public final ObjectProperty<VPos> valignmentProperty()
      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.

      See Also:

      getValignment(), setValignment(VPos)

    • setFillHeight

      public final void setFillHeight(boolean value)
      Sets the value of the property fillHeight.

      Property description:

      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.

    • isFillHeight

      public final boolean isFillHeight()
      Gets the value of the property fillHeight.

      Property description:

      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.

    • fillHeightProperty

      public final BooleanProperty fillHeightProperty()
      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.

      See Also:

      isFillHeight(), setFillHeight(boolean)

    • toString

      public String toString()
      Returns a string representation of this RowConstraints object.

      Overrides:

      toString in class Object

      Returns:

      a string representation of this RowConstraints object.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API