Java Code Examples for javafx.scene.layout.VBox#setMaxWidth()

The following examples show how to use javafx.scene.layout.VBox#setMaxWidth() . 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: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private VBox getBuyerSecurityDepositBox() {
    Tuple3<HBox, InfoInputTextField, Label> tuple = getEditableValueBoxWithInfo(
            Res.get("createOffer.securityDeposit.prompt"));
    buyerSecurityDepositInfoInputTextField = tuple.second;
    buyerSecurityDepositInputTextField = buyerSecurityDepositInfoInputTextField.getInputTextField();
    buyerSecurityDepositPercentageLabel = tuple.third;
    // getEditableValueBox delivers BTC, so we overwrite it with %
    buyerSecurityDepositPercentageLabel.setText("%");

    Tuple2<Label, VBox> tradeInputBoxTuple = getTradeInputBox(tuple.first, model.getSecurityDepositLabel());
    VBox depositBox = tradeInputBoxTuple.second;
    buyerSecurityDepositLabel = tradeInputBoxTuple.first;
    depositBox.setMaxWidth(310);

    editOfferElements.add(buyerSecurityDepositInputTextField);
    editOfferElements.add(buyerSecurityDepositPercentageLabel);

    return depositBox;
}
 
Example 2
Source File: MyBoxController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
private void makeImagePopup() {
    try {
        imagePop = new Popup();
        imagePop.setWidth(600);
        imagePop.setHeight(600);

        VBox vbox = new VBox();
        VBox.setVgrow(vbox, Priority.ALWAYS);
        HBox.setHgrow(vbox, Priority.ALWAYS);
        vbox.setMaxWidth(Double.MAX_VALUE);
        vbox.setMaxHeight(Double.MAX_VALUE);
        vbox.setStyle("-fx-background-color: white;");
        imagePop.getContent().add(vbox);

        view = new ImageView();
        view.setFitWidth(500);
        view.setFitHeight(500);
        vbox.getChildren().add(view);

        text = new Text();
        text.setStyle("-fx-font-size: 1.2em;");

        vbox.getChildren().add(text);
        vbox.setPadding(new Insets(15, 15, 15, 15));

    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
Example 3
Source File: SearchBoxSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SearchBoxSample() {
    String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
    VBox vbox = VBoxBuilder.create().build();
    vbox.getStylesheets().add(searchBoxCss);
    vbox.setPrefWidth(200);
    vbox.setMaxWidth(Control.USE_PREF_SIZE);
    vbox.getChildren().add(new SearchBox());
    getChildren().add(vbox);
}
 
Example 4
Source File: SearchBoxSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public SearchBoxSample() {
    String searchBoxCss = SearchBoxSample.class.getResource("SearchBox.css").toExternalForm();
    VBox vbox = VBoxBuilder.create().build();
    vbox.getStylesheets().add(searchBoxCss);
    vbox.setPrefWidth(200);
    vbox.setMaxWidth(Control.USE_PREF_SIZE);
    vbox.getChildren().add(new SearchBox());
    getChildren().add(vbox);
}
 
Example 5
Source File: Styler.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
public static VBox vContainer(Node... nodes) {
    VBox vBox = new VBox();
    VBox.setVgrow(vBox, Priority.ALWAYS);
    vBox.setMaxWidth(Double.MAX_VALUE);
    for (Node r : nodes) {
        vBox.getChildren().add(r);
    }
    return vBox;
}
 
Example 6
Source File: Styler.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
public static VBox vContainer(int spacing, Node... nodes) {
    VBox vBox = new VBox(spacing);
    VBox.setVgrow(vBox, Priority.ALWAYS);
    vBox.setMaxWidth(Double.MAX_VALUE);
    for (Node r : nodes) {
        vBox.getChildren().add(r);
    }
    return vBox;
}
 
Example 7
Source File: NewTradeProtocolLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@NotNull
private VBox getFeatureBox(String title, String description, String imageId, String url) {
    Label featureTitle = new Label(title);
    featureTitle.setTextAlignment(TextAlignment.LEFT);
    featureTitle.getStyleClass().add("news-feature-headline");

    ImageView sectionScreenshot = new ImageView();
    sectionScreenshot.setId(imageId);

    HBox imageContainer = new HBox(sectionScreenshot);
    imageContainer.getStyleClass().add("news-feature-image");

    Label featureDescription = new Label(description);
    featureDescription.setTextAlignment(TextAlignment.LEFT);
    featureDescription.getStyleClass().add("news-feature-description");
    featureDescription.setWrapText(true);

    HyperlinkWithIcon learnMore = new ExternalHyperlink(Res.get("shared.learnMore"), "highlight");
    learnMore.setOnAction(event -> {

        if (DontShowAgainLookup.showAgain(GUIUtil.OPEN_WEB_PAGE_KEY)) {
            hide();
            GUIUtil.openWebPage(url, true, () -> {
                this.rowIndex = -1;
                this.show();
            });
        } else {
            GUIUtil.openWebPage(url);
        }
    });

    VBox vBox = new VBox(featureTitle, imageContainer, featureDescription, learnMore);
    vBox.setAlignment(Pos.CENTER_LEFT);
    vBox.setSpacing(20);
    vBox.setMaxWidth(300);
    return vBox;
}
 
Example 8
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private VBox getTradeFeeFieldsBox() {
    tradeFeeInBtcLabel = new Label();
    tradeFeeInBtcLabel.setMouseTransparent(true);
    tradeFeeInBtcLabel.setId("trade-fee-textfield");

    tradeFeeInBsqLabel = new Label();
    tradeFeeInBsqLabel.setMouseTransparent(true);
    tradeFeeInBsqLabel.setId("trade-fee-textfield");

    VBox vBox = new VBox();
    vBox.setSpacing(6);
    vBox.setMaxWidth(300);
    vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
    vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);

    tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBtcToggle.setText("BTC");
    tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

    tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBsqToggle.setText("BSQ");
    tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));

    VBox tradeFeeToggleButtonBox = new VBox();
    tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);

    HBox hBox = new HBox();
    hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
    hBox.setMinHeight(47);
    hBox.setMaxHeight(hBox.getMinHeight());
    HBox.setHgrow(vBox, Priority.ALWAYS);
    HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);

    final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));

    tradeFeeDescriptionLabel = tradeInputBox.first;

    return tradeInputBox.second;
}
 
Example 9
Source File: ImagesBrowserController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
private void makeImagePopup(VBox imageBox, ImageInformation imageInfo,
        ImageView iView) {
    try {
        File file = imageInfo.getImageFileInformation().getFile();
        final Image iImage = imageInfo.getImage();
        imagePop = new Popup();
        imagePop.setWidth(popSize + 40);
        imagePop.setHeight(popSize + 40);
        imagePop.setAutoHide(true);

        VBox vbox = new VBox();
        VBox.setVgrow(vbox, Priority.ALWAYS);
        HBox.setHgrow(vbox, Priority.ALWAYS);
        vbox.setMaxWidth(Double.MAX_VALUE);
        vbox.setMaxHeight(Double.MAX_VALUE);
        vbox.setStyle("-fx-background-color: white;");
        imagePop.getContent().add(vbox);

        popView = new ImageView();
        popView.setImage(iImage);
        if (iImage.getWidth() > iImage.getHeight()) {
            popView.setFitWidth(popSize);
        } else {
            popView.setFitHeight(popSize);
        }
        popView.setPreserveRatio(true);
        vbox.getChildren().add(popView);

        popText = new Text();
        popText.setStyle("-fx-font-size: 1.0em;");

        vbox.getChildren().add(popText);
        vbox.setPadding(new Insets(15, 15, 15, 15));

        String info = imageInfo.getFileName() + "\n"
                + AppVariables.message("Format") + ":" + imageInfo.getImageFormat() + "  "
                + AppVariables.message("ModifyTime") + ":" + DateTools.datetimeToString(file.lastModified()) + "\n"
                + AppVariables.message("Size") + ":" + FileTools.showFileSize(file.length()) + "  "
                + AppVariables.message("Pixels") + ":" + imageInfo.getWidth() + "x" + imageInfo.getHeight() + "\n"
                + AppVariables.message("LoadedSize") + ":"
                + (int) iView.getImage().getWidth() + "x" + (int) iView.getImage().getHeight() + "  "
                + AppVariables.message("DisplayedSize") + ":"
                + (int) iView.getFitWidth() + "x" + (int) iView.getFitHeight();
        popText.setText(info);
        popText.setWrappingWidth(popSize);
        Bounds bounds = imageBox.localToScreen(imageBox.getBoundsInLocal());
        imagePop.show(imageBox, bounds.getMinX() + bounds.getWidth() / 2, bounds.getMinY());

    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
Example 10
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private VBox getTradeFeeFieldsBox() {
    tradeFeeInBtcLabel = new Label();
    tradeFeeInBtcLabel.setMouseTransparent(true);
    tradeFeeInBtcLabel.setId("trade-fee-textfield");

    tradeFeeInBsqLabel = new Label();
    tradeFeeInBsqLabel.setMouseTransparent(true);
    tradeFeeInBsqLabel.setId("trade-fee-textfield");

    VBox vBox = new VBox();
    vBox.setSpacing(6);
    vBox.setMaxWidth(300);
    vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
    vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);

    tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBtcToggle.setText("BTC");
    tradeFeeInBtcToggle.setVisible(false);
    tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

    tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBsqToggle.setText("BSQ");
    tradeFeeInBsqToggle.setVisible(false);
    tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));

    VBox tradeFeeToggleButtonBox = new VBox();
    tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);

    HBox hBox = new HBox();
    hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
    hBox.setMinHeight(47);
    hBox.setMaxHeight(hBox.getMinHeight());
    HBox.setHgrow(vBox, Priority.ALWAYS);
    HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);

    final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));

    tradeFeeDescriptionLabel = tradeInputBox.first;

    return tradeInputBox.second;
}