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

The following examples show how to use javafx.scene.layout.HBox#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: PluginParametersPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
private void addElements(final PluginParametersNode node, final Region... elements) {
    final HBox singleParam = new HBox();
    singleParam.setSpacing(10);
    for (Region element : elements) {
        if (element != null) {
            singleParam.getChildren().addAll(element);
        }
    }
    ColumnConstraints paramConstraints = new ColumnConstraints();
    if (!SHOULD_NOT_EXPAND.contains(node.getParameter().getType().getId())) {
        singleParam.setMinWidth(USE_PREF_SIZE);
    }
    paramConstraints.minWidthProperty().bind(singleParam.minWidthProperty());
    paramGroupGridPane.getColumnConstraints().add(paramConstraints);
    paramGroupGridPane.add(singleParam, currentCol++, 0);
}
 
Example 2
Source File: NewTradeProtocolLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createContent() {
    HBox content = new HBox();
    content.setMinWidth(680);
    content.setAlignment(Pos.TOP_LEFT);
    content.setSpacing(40);

    VBox accountSigning = getFeatureBox(Res.get("popup.news.launch.accountSigning.headline"),
            Res.get("popup.news.launch.accountSigning.description"),
            "image-account-signing-screenshot",
            "https://docs.bisq.network/payment-methods#account-signing");

    VBox newTradeProtocol = getFeatureBox(Res.get("popup.news.launch.ntp.headline"),
            Res.get("popup.news.launch.ntp.description"),
            "image-new-trade-protocol-screenshot",
            "https://docs.bisq.network/trading-rules");

    content.getChildren().addAll(accountSigning, new Separator(Orientation.VERTICAL), newTradeProtocol);

    GridPane.setMargin(content, new Insets(10, 0, 0, 0));
    GridPane.setRowIndex(content, ++rowIndex);
    GridPane.setColumnSpan(content, 2);
    GridPane.setHgrow(content, Priority.ALWAYS);
    gridPane.getChildren().add(content);
}
 
Example 3
Source File: PanelMenuBar.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private HBox createNameArea() {
    HBox nameArea = new HBox();

    nameText = new Text(panelName);
    nameText.setId(IdGenerator.getPanelNameAreaId(panel.panelIndex));
    nameText.setWrappingWidth(NAME_DISPLAY_WIDTH);

    nameBox = new HBox();
    nameBox.getChildren().add(nameText);
    nameBox.setMinWidth(NAME_DISPLAY_WIDTH);
    nameBox.setMaxWidth(NAME_DISPLAY_WIDTH);
    nameBox.setAlignment(Pos.CENTER_LEFT);

    nameBox.setOnMouseClicked(mouseEvent -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY)
                && mouseEvent.getClickCount() == 2) {

            mouseEvent.consume();
            activateInplaceRename();
        }
    });
    Tooltip.install(nameArea, new Tooltip("Double click to edit the name of this panel"));

    nameArea.getChildren().add(nameBox);
    nameArea.setMinWidth(NAME_AREA_WIDTH);
    nameArea.setMaxWidth(NAME_AREA_WIDTH);
    nameArea.setPadding(new Insets(0, 10, 0, 5));
    return nameArea;
}
 
Example 4
Source File: SelectionStripSkin.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor for all SkinBase instances.
 *
 * @param strip The strip for which this Skin should attach to.
 */
public SelectionStripSkin(SelectionStrip<T> strip) {
  super(strip);

  content = new HBox();
  content.setMinWidth(Region.USE_PREF_SIZE);
  content.setMaxWidth(Double.MAX_VALUE);
  content.setAlignment(Pos.CENTER_LEFT);

  leftBtn = new Region();
  leftBtn.getStyleClass().addAll("scroller", "left");
  leftBtn.setOpacity(0);
  leftBtn.setVisible(false);

  rightBtn = new Region();
  rightBtn.getStyleClass().addAll("scroller", "right");
  rightBtn.setOpacity(0);
  rightBtn.setVisible(false);

  leftFader = new Region();
  leftFader.setMouseTransparent(true);
  leftFader.getStyleClass().addAll("fader", "left");
  leftFader.setOpacity(0);

  rightFader = new Region();
  rightFader.setMouseTransparent(true);
  rightFader.getStyleClass().addAll("fader", "right");
  rightFader.setOpacity(0);

  getChildren().addAll(content, leftFader, rightFader, leftBtn, rightBtn);
  getChildren().forEach(child -> child.setManaged(false));

  Rectangle clip = new Rectangle();
  clip.widthProperty().bind(strip.widthProperty());
  clip.heightProperty().bind(strip.heightProperty());
  getSkinnable().setClip(clip);

  setupListeners();
  setupBindings();
  setupEventHandlers();

  strip.itemsProperty().addListener((Observable it) -> buildContent());
  buildContent();
}
 
Example 5
Source File: JFXDecorator.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
private void initializeContainers(Node node, boolean fullScreen, boolean max, boolean min) {
    buttonsContainer = new HBox();
    buttonsContainer.getStyleClass().add("jfx-decorator-buttons-container");
    buttonsContainer.setBackground(new Background(new BackgroundFill(Color.BLACK,
        CornerRadii.EMPTY,
        Insets.EMPTY)));
    // BINDING
    buttonsContainer.setPadding(new Insets(4));
    buttonsContainer.setAlignment(Pos.CENTER_RIGHT);

    // customize decorator buttons
    List<JFXButton> btns = new ArrayList<>();
    if (fullScreen) {
        btns.add(btnFull);
    }
    if (min) {
        btns.add(btnMin);
    }
    if (max) {
        btns.add(btnMax);
        // maximize/restore the window on header double click
        buttonsContainer.addEventHandler(MouseEvent.MOUSE_CLICKED, (mouseEvent) -> {
            if (mouseEvent.getClickCount() == 2) {
                btnMax.fire();
            }
        });
    }
    btns.add(btnClose);

    text = new Text();
    text.getStyleClass().addAll("jfx-decorator-text", "title", "jfx-decorator-title");
    text.setFill(Color.WHITE);
    text.textProperty().bind(title); //binds the Text's text to title
    title.bind(primaryStage.titleProperty()); //binds title to the primaryStage's title

    graphicContainer = new HBox();
    graphicContainer.setPickOnBounds(false);
    graphicContainer.setAlignment(Pos.CENTER_LEFT);
    graphicContainer.getChildren().setAll(text);

    HBox graphicTextContainer = new HBox(graphicContainer, text);
    graphicTextContainer.getStyleClass().add("jfx-decorator-title-container");
    graphicTextContainer.setAlignment(Pos.CENTER_LEFT);
    graphicTextContainer.setPickOnBounds(false);
    HBox.setHgrow(graphicTextContainer, Priority.ALWAYS);
    HBox.setMargin(graphicContainer, new Insets(0, 8, 0, 8));

    buttonsContainer.getChildren().setAll(graphicTextContainer);
    buttonsContainer.getChildren().addAll(btns);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_ENTERED, (enter) -> allowMove = true);
    buttonsContainer.addEventHandler(MouseEvent.MOUSE_EXITED, (enter) -> {
        if (!isDragging) {
            allowMove = false;
        }
    });
    buttonsContainer.setMinWidth(180);
    contentPlaceHolder.getStyleClass().add("jfx-decorator-content-container");
    contentPlaceHolder.setMinSize(0, 0);
    StackPane clippedContainer = new StackPane(node);
    contentPlaceHolder.getChildren().add(clippedContainer);
    ((Region) node).setMinSize(0, 0);
    VBox.setVgrow(contentPlaceHolder, Priority.ALWAYS);
    contentPlaceHolder.getStyleClass().add("resize-border");
    contentPlaceHolder.setBorder(new Border(new BorderStroke(Color.BLACK,
        BorderStrokeStyle.SOLID,
        CornerRadii.EMPTY,
        new BorderWidths(0, 4, 4, 4))));
    // BINDING

    Rectangle clip = new Rectangle();
    clip.widthProperty().bind(clippedContainer.widthProperty());
    clip.heightProperty().bind(clippedContainer.heightProperty());
    clippedContainer.setClip(clip);
    this.getChildren().addAll(buttonsContainer, contentPlaceHolder);
}
 
Example 6
Source File: WalletPasswordWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void addButtons() {
    BusyAnimation busyAnimation = new BusyAnimation(false);
    Label deriveStatusLabel = new AutoTooltipLabel();

    unlockButton = new AutoTooltipButton(Res.get("shared.unlock"));
    unlockButton.setDefaultButton(true);
    unlockButton.getStyleClass().add("action-button");
    unlockButton.setDisable(true);
    unlockButton.setOnAction(e -> {
        String password = passwordTextField.getText();
        checkArgument(password.length() < 500, Res.get("password.tooLong"));
        KeyCrypterScrypt keyCrypterScrypt = walletsManager.getKeyCrypterScrypt();
        if (keyCrypterScrypt != null) {
            busyAnimation.play();
            deriveStatusLabel.setText(Res.get("password.deriveKey"));
            ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
                if (walletsManager.checkAESKey(aesKey)) {
                    if (aesKeyHandler != null)
                        aesKeyHandler.onAesKey(aesKey);

                    hide();
                } else {
                    busyAnimation.stop();
                    deriveStatusLabel.setText("");

                    UserThread.runAfter(() -> new Popup()
                            .warning(Res.get("password.wrongPw"))
                            .onClose(this::blurAgain).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
                }
            });
        } else {
            log.error("wallet.getKeyCrypter() is null, that must not happen.");
        }
    });

    forgotPasswordButton = new AutoTooltipButton(Res.get("password.forgotPassword"));
    forgotPasswordButton.setOnAction(e -> {
        forgotPasswordButton.setDisable(true);
        unlockButton.setDefaultButton(false);
        showRestoreScreen();
    });

    Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
    cancelButton.setOnAction(event -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });

    HBox hBox = new HBox();
    hBox.setMinWidth(560);
    hBox.setPadding(new Insets(0, 0, 0, 0));
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().add(unlockButton);
    if (!hideForgotPasswordButton)
        hBox.getChildren().add(forgotPasswordButton);
    if (!hideCloseButton)
        hBox.getChildren().add(cancelButton);
    hBox.getChildren().addAll(busyAnimation, deriveStatusLabel);
    gridPane.getChildren().add(hBox);


    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.LEFT);
    columnConstraints1.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1);
}