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

The following examples show how to use javafx.scene.layout.GridPane#setFillWidth() . 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: RadioButtonDrivenTextFieldsPane.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
public void addRow(RadioButton radio, Region field, Text helpIcon) {
    requireNotNullArg(radio, "Cannot add a null radio");
    requireNotNullArg(field, "Cannot add a null field");
    GridPane.setValignment(radio, VPos.BOTTOM);
    GridPane.setValignment(field, VPos.BOTTOM);
    GridPane.setHalignment(radio, HPos.LEFT);
    GridPane.setHalignment(field, HPos.LEFT);
    GridPane.setFillWidth(field, true);
    field.setPrefWidth(300);
    field.setDisable(true);
    radio.selectedProperty().addListener((o, oldVal, newVal) -> {
        field.setDisable(!newVal);
        if (newVal) {
            field.requestFocus();
        }
    });
    radio.setToggleGroup(group);
    add(radio, 0, rows);
    add(field, 1, rows);
    if (nonNull(helpIcon)) {
        add(helpIcon, 2, rows);
    }
    rows++;

}
 
Example 3
Source File: SegmentMeshExporterDialog.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
private int createCommonDialog(final GridPane contents)
{
	int row = 0;

	contents.add(new Label("Scale"), 0, row);
	contents.add(scale, 1, row);
	GridPane.setFillWidth(scale, true);
	++row;

	contents.add(new Label("Format"), 0, row);

	final List<String>           typeNames = Stream.of(FILETYPE.values()).map(FILETYPE::name).collect(Collectors
			.toList());
	final ObservableList<String> options   = FXCollections.observableArrayList(typeNames);
	fileFormats = new ComboBox<>(options);
	fileFormats.getSelectionModel().select(0);
	fileFormats.setMinWidth(0);
	fileFormats.setMaxWidth(Double.POSITIVE_INFINITY);
	contents.add(fileFormats, 1, row);
	fileFormats.maxWidth(300);
	GridPane.setFillWidth(fileFormats, true);
	GridPane.setHgrow(fileFormats, Priority.ALWAYS);

	++row;

	contents.add(new Label("Save to:"), 0, row);
	contents.add(filePath, 1, row);

	this.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.OK);
	this.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(this.isError);

	return row;
}
 
Example 4
Source File: MeshExporterDialog.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
private int createCommonDialog(final GridPane contents)
{
	int row = 0;

	contents.add(new Label("Scale"), 0, row);
	contents.add(scale, 1, row);
	GridPane.setFillWidth(scale, true);
	++row;

	contents.add(new Label("Format"), 0, row);

	final List<String>           typeNames = Stream.of(FILETYPE.values()).map(FILETYPE::name).collect(Collectors
			.toList());
	final ObservableList<String> options   = FXCollections.observableArrayList(typeNames);
	fileFormats = new ComboBox<>(options);
	fileFormats.getSelectionModel().select(0);
	fileFormats.setMinWidth(0);
	fileFormats.setMaxWidth(Double.POSITIVE_INFINITY);
	contents.add(fileFormats, 1, row);
	fileFormats.maxWidth(300);
	GridPane.setFillWidth(fileFormats, true);
	GridPane.setHgrow(fileFormats, Priority.ALWAYS);

	++row;

	contents.add(new Label("Save to:"), 0, row);
	contents.add(dirPath, 1, row);

	this.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.OK);
	this.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(this.isError);

	return row;
}
 
Example 5
Source File: Properties.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private void setCommand(final TreeItem<ScanCommand> tree_item)
{
    final GridPane prop_grid = new GridPane();
    prop_grid.setPadding(new Insets(5));
    prop_grid.setHgap(5);
    prop_grid.setVgap(5);

    if (tree_item != null)
    {
        int row = 0;
        for (ScanCommandProperty prop : tree_item.getValue().getProperties())
        {
            final Label label = new Label(prop.getName());
            prop_grid.add(label, 0, row);

            try
            {
                final Node editor = createEditor(tree_item, prop);
                GridPane.setHgrow(editor, Priority.ALWAYS);
                GridPane.setFillWidth(editor, true);

                // Label defaults to vertical center,
                // which is good for one-line editors.
                if (editor instanceof StringArrayEditor)
                    GridPane.setValignment(label, VPos.TOP);

                prop_grid.add(editor, 1, row++);
            }
            catch (Exception ex)
            {
                logger.log(Level.WARNING, "Cannot create editor for " + prop, ex);
            }
            ++row;
        }
    }

    scroll.setContent(prop_grid);
}
 
Example 6
Source File: TradeSubView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
void addWizardsToGridPane(TradeWizardItem tradeWizardItem) {
    if (leftGridPaneRowIndex == 0)
        GridPane.setMargin(tradeWizardItem, new Insets(Layout.FIRST_ROW_DISTANCE + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));

    GridPane.setRowIndex(tradeWizardItem, leftGridPaneRowIndex++);
    leftGridPane.getChildren().add(tradeWizardItem);
    GridPane.setRowSpan(tradeProcessTitledGroupBg, leftGridPaneRowIndex);
    GridPane.setFillWidth(tradeWizardItem, true);
}
 
Example 7
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++;
    }
}
 
Example 8
Source File: TradeStepView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
protected void addTradeInfoBlock() {
    TitledGroupBg tradeInfoTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 3,
            Res.get("portfolio.pending.tradeInformation"));
    GridPane.setColumnSpan(tradeInfoTitledGroupBg, 2);

    final Tuple3<Label, TxIdTextField, VBox> labelTxIdTextFieldVBoxTuple3 =
            addTopLabelTxIdTextField(gridPane, gridRow,
                    Res.get("shared.depositTransactionId"),
                    Layout.COMPACT_FIRST_ROW_DISTANCE);

    GridPane.setColumnSpan(labelTxIdTextFieldVBoxTuple3.third, 2);
    txIdTextField = labelTxIdTextFieldVBoxTuple3.second;

    String id = model.dataModel.txId.get();
    if (!id.isEmpty())
        txIdTextField.setup(id);
    else
        txIdTextField.cleanup();

    if (model.dataModel.getTrade() != null) {
        checkNotNull(model.dataModel.getTrade().getOffer(), "Offer must not be null in TradeStepView");
        InfoTextField infoTextField = addOpenTradeDuration(gridPane, ++gridRow,
                model.dataModel.getTrade().getOffer());
        infoTextField.setContentForInfoPopOver(createInfoPopover());
    }

    final Tuple3<Label, TextField, VBox> labelTextFieldVBoxTuple3 = addCompactTopLabelTextField(gridPane, gridRow,
            1, Res.get("portfolio.pending.remainingTime"), "");

    timeLeftTextField = labelTextFieldVBoxTuple3.second;
    timeLeftTextField.setMinWidth(400);

    timeLeftProgressBar = new JFXProgressBar(0);
    timeLeftProgressBar.setOpacity(0.7);
    timeLeftProgressBar.setMinHeight(9);
    timeLeftProgressBar.setMaxHeight(9);
    timeLeftProgressBar.setMaxWidth(Double.MAX_VALUE);

    GridPane.setRowIndex(timeLeftProgressBar, ++gridRow);
    GridPane.setColumnSpan(timeLeftProgressBar, 2);
    GridPane.setFillWidth(timeLeftProgressBar, true);
    gridPane.getChildren().add(timeLeftProgressBar);

    updateTimeLeft();
}