Java Code Examples for javafx.scene.layout.ColumnConstraints#setMinWidth()

The following examples show how to use javafx.scene.layout.ColumnConstraints#setMinWidth() . 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: EasyGridPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public void addColumnConstraint(boolean fillWidth, HPos alignment, Priority grow, double maxWidth, double minWidth, double prefWidth, double percentWidth) {
    ColumnConstraints constraint = new ColumnConstraints();
    constraint.setFillWidth(fillWidth);
    constraint.setHalignment(alignment);
    constraint.setHgrow(grow);
    constraint.setMaxWidth(maxWidth);
    constraint.setMinWidth(minWidth);
    constraint.setPrefWidth(prefWidth);

    if (percentWidth >= 0) {
        constraint.setPercentWidth(percentWidth);
    }

    getColumnConstraints().add(constraint);
}
 
Example 2
Source File: ConversationBox.java    From constellation with Apache License 2.0 5 votes vote down vote up
public BubbleBox(final ConversationMessage message) {
    setVgap(3);

    final ColumnConstraints spaceColumn = new ColumnConstraints();
    spaceColumn.setHgrow(Priority.ALWAYS);
    spaceColumn.setMinWidth(50);
    spaceColumn.setPrefWidth(50);

    final ColumnConstraints contentColumn = new ColumnConstraints();
    contentColumn.setHalignment(message.getConversationSide() == ConversationSide.LEFT ? HPos.LEFT : HPos.RIGHT);
    contentColumn.setFillWidth(false);
    contentColumn.setHgrow(Priority.NEVER);

    final RowConstraints contentRow = new RowConstraints();
    contentRow.setFillHeight(true);
    contentRow.setMaxHeight(Double.MAX_VALUE);
    contentRow.setValignment(VPos.TOP);

    getRowConstraints().addAll(contentRow);

    if (message.getConversationSide() == ConversationSide.LEFT) {
        contentColumnIndex = 0;
        getColumnConstraints().addAll(contentColumn, spaceColumn);
    } else {
        contentColumnIndex = 1;
        getColumnConstraints().addAll(spaceColumn, contentColumn);
    }

    update(message);
}
 
Example 3
Source File: FormPane.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public FormPane(String styleClass, int columns) {
    this.columns = columns;
    getStyleClass().addAll("form-pane", styleClass);
    ColumnConstraints cc = new ColumnConstraints();
    cc.setMinWidth(Region.USE_PREF_SIZE);
    getColumnConstraints().add(cc);
    getStyleClass().add(StyleClassHelper.BACKGROUND);
}
 
Example 4
Source File: Util.java    From pattypan with MIT License 5 votes vote down vote up
public static ColumnConstraints newColumn(int value, String unit, HPos position) {
  ColumnConstraints col = new ColumnConstraints();
  if (unit.equals("%")) {
    col.setPercentWidth(value);
  }
  if (unit.equals("px")) {
    col.setMaxWidth(value);
    col.setMinWidth(value);
  }

  if (position != null) {
    col.setHalignment(position);
  }
  return col;
}
 
Example 5
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example 6
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(15, 15, -1, 15));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example 7
Source File: AgentRegistrationView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void buildUI() {
    GridPane gridPane = new GridPane();
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    columnConstraints1.setMinWidth(200);
    columnConstraints1.setMaxWidth(500);
    gridPane.getColumnConstraints().addAll(columnConstraints1);
    root.getChildren().add(gridPane);

    addTitledGroupBg(gridPane, gridRow, 4, Res.get("account.arbitratorRegistration.registration", getRole()));
    TextField pubKeyTextField = addTopLabelTextField(gridPane, gridRow, Res.get("account.arbitratorRegistration.pubKey"),
            model.registrationPubKeyAsHex.get(), Layout.FIRST_ROW_DISTANCE).second;

    pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);

    Tuple3<Label, ListView<String>, VBox> tuple = FormBuilder.addTopLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
    GridPane.setValignment(tuple.first, VPos.TOP);
    languagesListView = tuple.second;
    languagesListView.disableProperty().bind(model.registrationEditDisabled);
    languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setCellFactory(new Callback<>() {
        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ListCell<>() {
                final Label label = new AutoTooltipLabel();
                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
                final Button removeButton = new AutoTooltipButton("", icon);
                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(LanguageUtil.getDisplayName(item));
                        removeButton.setOnAction(e -> onRemoveLanguage(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });

    languageComboBox = FormBuilder.addComboBox(gridPane, ++gridRow);
    languageComboBox.disableProperty().bind(model.registrationEditDisabled);
    languageComboBox.setPromptText(Res.get("shared.addLanguage"));
    languageComboBox.setConverter(new StringConverter<>() {
        @Override
        public String toString(String code) {
            return LanguageUtil.getDisplayName(code);
        }

        @Override
        public String fromString(String s) {
            return null;
        }
    });
    languageComboBox.setOnAction(e -> onAddLanguage());

    Tuple2<Button, Button> buttonButtonTuple2 = add2ButtonsAfterGroup(gridPane, ++gridRow,
            Res.get("account.arbitratorRegistration.register"), Res.get("account.arbitratorRegistration.revoke"));
    Button registerButton = buttonButtonTuple2.first;
    registerButton.disableProperty().bind(model.registrationEditDisabled);
    registerButton.setOnAction(e -> onRegister());

    Button revokeButton = buttonButtonTuple2.second;
    revokeButton.setDefaultButton(false);
    revokeButton.disableProperty().bind(model.revokeButtonDisabled);
    revokeButton.setOnAction(e -> onRevoke());

    final TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 2,
            Res.get("shared.information"), Layout.GROUP_DISTANCE);

    titledGroupBg.getStyleClass().add("last");

    Label infoLabel = addMultilineLabel(gridPane, gridRow);
    GridPane.setMargin(infoLabel, new Insets(Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
    infoLabel.setText(Res.get("account.arbitratorRegistration.info.msg", getRole().toLowerCase()));
}