< prev index next >

modules/graphics/src/main/java/javafx/scene/layout/RowConstraints.java

Print this page




  27 
  28 import static javafx.scene.layout.Region.USE_COMPUTED_SIZE;
  29 import static javafx.scene.layout.Region.USE_PREF_SIZE;
  30 import javafx.beans.property.BooleanProperty;
  31 import javafx.beans.property.BooleanPropertyBase;
  32 import javafx.beans.property.DoubleProperty;
  33 import javafx.beans.property.DoublePropertyBase;
  34 import javafx.beans.property.ObjectProperty;
  35 import javafx.beans.property.ObjectPropertyBase;
  36 import javafx.geometry.VPos;
  37 
  38 
  39 /**
  40  * Defines optional layout constraints for a row in a {@link GridPane}.
  41  * If a RowConstraints object is added for a row in a gridpane, the gridpane
  42  * will use those constraint values when computing the row's height and layout.
  43  * <p>
  44  * For example, to create a GridPane with 10 rows 50 pixels tall:
  45  * <pre><code>
  46  *     GridPane gridpane = new GridPane();
  47  *     for (int i = 0; i < 10; i++) {
  48  *         RowConstraints row = new RowConstraints(50);
  49  *         gridpane.getRowConstraints().add(row);
  50  *     }
  51  * </code></pre>
  52  * Or, to create a GridPane where rows take 25%, 50%, 25% of its width:
  53  * <pre><code>
  54  *     GridPane gridpane = new GridPane();
  55  *     RowConstraints row1 = new RowConstraints();
  56  *     row1.setPercentWidth(25);
  57  *     RowConstraints row2 = new RowConstraints();
  58  *     row2.setPercentWidth(50);
  59  *     RowConstraints row3 = new RowConstraints();
  60  *     row3.setPercentWidth(25);
  61  *     gridpane.getRowConstraints().addAll(row1,row2,row3);
  62  * </code></pre>
  63  *
  64  * Note that adding an empty RowConstraints object has the effect of not setting
  65  * any constraints, leaving the GridPane to compute the row's layout based
  66  * solely on its content's size preferences and constraints.
  67  *




  27 
  28 import static javafx.scene.layout.Region.USE_COMPUTED_SIZE;
  29 import static javafx.scene.layout.Region.USE_PREF_SIZE;
  30 import javafx.beans.property.BooleanProperty;
  31 import javafx.beans.property.BooleanPropertyBase;
  32 import javafx.beans.property.DoubleProperty;
  33 import javafx.beans.property.DoublePropertyBase;
  34 import javafx.beans.property.ObjectProperty;
  35 import javafx.beans.property.ObjectPropertyBase;
  36 import javafx.geometry.VPos;
  37 
  38 
  39 /**
  40  * Defines optional layout constraints for a row in a {@link GridPane}.
  41  * If a RowConstraints object is added for a row in a gridpane, the gridpane
  42  * will use those constraint values when computing the row's height and layout.
  43  * <p>
  44  * For example, to create a GridPane with 10 rows 50 pixels tall:
  45  * <pre><code>
  46  *     GridPane gridpane = new GridPane();
  47  *     for (int i = 0; i &lt; 10; i++) {
  48  *         RowConstraints row = new RowConstraints(50);
  49  *         gridpane.getRowConstraints().add(row);
  50  *     }
  51  * </code></pre>
  52  * Or, to create a GridPane where rows take 25%, 50%, 25% of its width:
  53  * <pre><code>
  54  *     GridPane gridpane = new GridPane();
  55  *     RowConstraints row1 = new RowConstraints();
  56  *     row1.setPercentWidth(25);
  57  *     RowConstraints row2 = new RowConstraints();
  58  *     row2.setPercentWidth(50);
  59  *     RowConstraints row3 = new RowConstraints();
  60  *     row3.setPercentWidth(25);
  61  *     gridpane.getRowConstraints().addAll(row1,row2,row3);
  62  * </code></pre>
  63  *
  64  * Note that adding an empty RowConstraints object has the effect of not setting
  65  * any constraints, leaving the GridPane to compute the row's layout based
  66  * solely on its content's size preferences and constraints.
  67  *


< prev index next >