Java Code Examples for javafx.scene.layout.GridPane#setFillHeight()

The following examples show how to use javafx.scene.layout.GridPane#setFillHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdatePane.java    From Recaf with MIT License 8 votes vote down vote up
/**
 * @param controller
 * 		Controller to use to close Recaf.
 */
public UpdatePane(GuiController controller) {
	this.controller = controller;
	Button btn = getButton();
	GridPane grid = new GridPane();
	GridPane.setFillHeight(btn, true);
	GridPane.setFillWidth(btn, true);
	grid.setPadding(new Insets(10));
	grid.setVgap(10);
	grid.setHgap(10);
	grid.add(getNotes(), 0, 0, 2, 1);
	grid.add(getInfo(), 0, 1, 1, 1);
	grid.add(btn, 1, 1, 1, 1);
	grid.add(getSubMessage(), 0, 2, 2, 1);
	setTop(getHeader());
	setCenter(grid);
}
 
Example 2
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
public Pane getParamPane(final PluginParametersNode node) {
    if (node.getChildren().isEmpty()) {
        return null;
    }

    final GridPane paramGroupPane = new PluginParametersPane();
    paramGroupPane.setMinHeight(0);
    GridPane.setHalignment(paramGroupPane, HPos.LEFT);
    paramGroupPane.setPadding(Insets.EMPTY);

    int row = 0;
    final DoubleProperty descriptionWidth = new SimpleDoubleProperty();
    DoubleProperty maxLabelWidth = new SimpleDoubleProperty();

    for (final PluginParametersNode child : node.getChildren()) {
        while (child.getFormatter().nextElement(child)) {
            final RowConstraints rowConstraints = new RowConstraints();
            rowConstraints.setVgrow(Priority.NEVER);
            rowConstraints.setFillHeight(true);
            paramGroupPane.getRowConstraints().addAll(rowConstraints);

            final LabelDescriptionBox label = child.getFormatter().getParamLabel(child);
            if (label != null) {
                paramGroupPane.add(label, 0, row);
                GridPane.setValignment(label, VPos.TOP);
                GridPane.setHgrow(label, Priority.ALWAYS);
                GridPane.setFillHeight(label, false);

                label.bindDescriptionToProperty(descriptionWidth);
                maxLabelWidth = label.updateBindingWithLabelWidth(maxLabelWidth);
            }

            final Pane paramPane = child.getFormatter().getParamPane(child);
            if (paramPane != null) {
                paramPane.setStyle("-fx-padding: " + PADDING);
                GridPane.setValignment(paramPane, VPos.TOP);
                GridPane.setFillHeight(paramPane, false);
                if (label == null) {
                    paramGroupPane.add(paramPane, 0, row, 2, 1);
                } else {
                    paramGroupPane.add(paramPane, 1, row);
                }
            }

            final Button paramHelp = child.getFormatter().getParamHelp(child);
            if (paramHelp != null) {
                paramGroupPane.add(paramHelp, 2, row);
                GridPane.setMargin(paramHelp, new Insets(PADDING, PADDING, 0, 0));
                GridPane.setValignment(paramHelp, VPos.TOP);
                GridPane.setFillHeight(paramHelp, false);
            }

            row++;
        }
    }

    descriptionWidth.bind(Bindings.max(50, maxLabelWidth));

    return paramGroupPane;
}
 
Example 3
Source File: TilingPane.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
protected void layoutNormal() {
    if (getChildren().isEmpty()) {
        return;
    }
    final int colsCount = getColumnsCount();

    if (getColumnConstraints().size() != colsCount) {
        final List<ColumnConstraints> colConstraintList = new ArrayList<>();
        for (int i = 0; i < colsCount; i++) {
            final ColumnConstraints colConstraints = new ColumnConstraints(); // NOPMD
            colConstraints.setPercentWidth(100.0 / colsCount);
            colConstraints.setFillWidth(true);
            colConstraintList.add(colConstraints);
        }
        getColumnConstraints().setAll(colConstraintList);
    }

    int rowIndex = 0;
    int colIndex = 0;
    int childCount = 0;
    final int nChildren = getChildren().size();
    int nColSpan = Math.max(1, colsCount / (nChildren - childCount));
    for (final Node child : getChildren()) {
        GridPane.setFillWidth(child, true);
        GridPane.setFillHeight(child, true);
        GridPane.setColumnIndex(child, colIndex);
        GridPane.setRowIndex(child, rowIndex);

        if ((colIndex == 0) && ((nChildren - childCount) < colsCount)) {
            nColSpan = Math.max(1, colsCount / (nChildren - childCount));
        }
        // last window fills up row
        if (((nChildren - childCount) == 1) && (colIndex < colsCount)) {
            nColSpan = colsCount - colIndex;
        }

        GridPane.setColumnSpan(child, nColSpan);

        colIndex += nColSpan;
        if (colIndex >= colsCount) {
            colIndex = 0;
            rowIndex++;
        }
        childCount++;
    }
}