Set JavaFX grow to column. - Java JavaFX

Java examples for JavaFX:GridPane

Description

Set JavaFX grow to column.

Demo Code


//package com.java2s;

import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;

public class Main {
    /**/*from ww w.j  a  va 2s . c o m*/
     * Set grow to column. If GridPane have more than 1 column,
     * <b>need use for each</b>.
     * @param grid
     */
    public static void autoSizeGridPaneColumns(GridPane grid) {
        ColumnConstraints cc = new ColumnConstraints();
        cc.setHgrow(Priority.ALWAYS);
        grid.getColumnConstraints().add(cc);
    }
}

Related Tutorials