Class ColumnConstraints

java.lang.Object
javafx.scene.layout.ConstraintsBase
javafx.scene.layout.ColumnConstraints

public class ColumnConstraints extends ConstraintsBase
Defines optional layout constraints for a column in a GridPane. If a ColumnConstraints object is added for a column in a gridpane, the gridpane will use those constraint values when computing the column's width and layout.

For example, to create a GridPane with 5 columns 100 pixels wide:


     GridPane gridpane = new GridPane();
     for (int i = 0; i < 5; i++) {
         ColumnConstraints column = new ColumnConstraints(100);
         gridpane.getColumnConstraints().add(column);
     }
 
Or, to create a GridPane where columns take 25%, 50%, 25% of its width:

     GridPane gridpane = new GridPane();
     ColumnConstraints col1 = new ColumnConstraints();
     col1.setPercentWidth(25);
     ColumnConstraints col2 = new ColumnConstraints();
     col2.setPercentWidth(50);
     ColumnConstraints col3 = new ColumnConstraints();
     col3.setPercentWidth(25);
     gridpane.getColumnConstraints().addAll(col1,col2,col3);
 
Note that adding an empty ColumnConstraints object has the effect of not setting any constraints, leaving the GridPane to compute the column's layout based solely on its content's size preferences and constraints.
Since:
JavaFX 2.0