< prev index next >

modules/graphics/src/main/java/javafx/scene/layout/ColumnConstraints.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.HPos;
  37 
  38 
  39 /**
  40  * Defines optional layout constraints for a column in a {@link GridPane}.
  41  * If a ColumnConstraints object is added for a column in a gridpane, the gridpane
  42  * will use those constraint values when computing the column's width and layout.
  43  * <p>
  44  * For example, to create a GridPane with 5 columns 100 pixels wide:
  45  * <pre><code>
  46  *     GridPane gridpane = new GridPane();
  47  *     for (int i = 0; i < 5; i++) {
  48  *         ColumnConstraints column = new ColumnConstraints(100);
  49  *         gridpane.getColumnConstraints().add(column);
  50  *     }
  51  * </code></pre>
  52  * Or, to create a GridPane where columns take 25%, 50%, 25% of its width:
  53  * <pre><code>
  54  *     GridPane gridpane = new GridPane();
  55  *     ColumnConstraints col1 = new ColumnConstraints();
  56  *     col1.setPercentWidth(25);
  57  *     ColumnConstraints col2 = new ColumnConstraints();
  58  *     col2.setPercentWidth(50);
  59  *     ColumnConstraints col3 = new ColumnConstraints();
  60  *     col3.setPercentWidth(25);
  61  *     gridpane.getColumnConstraints().addAll(col1,col2,col3);
  62  * </code></pre>
  63  *
  64  * Note that adding an empty ColumnConstraints object has the effect of not setting
  65  * any constraints, leaving the GridPane to compute the column'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.HPos;
  37 
  38 
  39 /**
  40  * Defines optional layout constraints for a column in a {@link GridPane}.
  41  * If a ColumnConstraints object is added for a column in a gridpane, the gridpane
  42  * will use those constraint values when computing the column's width and layout.
  43  * <p>
  44  * For example, to create a GridPane with 5 columns 100 pixels wide:
  45  * <pre><code>
  46  *     GridPane gridpane = new GridPane();
  47  *     for (int i = 0; i &lt; 5; i++) {
  48  *         ColumnConstraints column = new ColumnConstraints(100);
  49  *         gridpane.getColumnConstraints().add(column);
  50  *     }
  51  * </code></pre>
  52  * Or, to create a GridPane where columns take 25%, 50%, 25% of its width:
  53  * <pre><code>
  54  *     GridPane gridpane = new GridPane();
  55  *     ColumnConstraints col1 = new ColumnConstraints();
  56  *     col1.setPercentWidth(25);
  57  *     ColumnConstraints col2 = new ColumnConstraints();
  58  *     col2.setPercentWidth(50);
  59  *     ColumnConstraints col3 = new ColumnConstraints();
  60  *     col3.setPercentWidth(25);
  61  *     gridpane.getColumnConstraints().addAll(col1,col2,col3);
  62  * </code></pre>
  63  *
  64  * Note that adding an empty ColumnConstraints object has the effect of not setting
  65  * any constraints, leaving the GridPane to compute the column's layout based
  66  * solely on its content's size preferences and constraints.
  67  *


< prev index next >