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

The following examples show how to use javafx.scene.layout.HBox#setSpacing() . 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: DemoSimpleGauge.java    From Enzo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    HBox pane = new HBox();
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.setSpacing(10);
    pane.getChildren().addAll(thermoMeter, wattMeter, energyMeter);

    final Scene scene = new Scene(pane, Color.BLACK);
    //scene.setFullScreen(true);

    stage.setTitle("SimpleGauge");
    stage.setScene(scene);
    stage.show();

    wattMeter.setValue(50);

    timer.start();

    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 2
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple3<Label, Button, Button> addTopLabel2Buttons(GridPane gridPane,
                                                                int rowIndex,
                                                                String labelText,
                                                                String title1,
                                                                String title2,
                                                                double top) {
    HBox hBox = new HBox();
    hBox.setSpacing(10);

    Button button1 = new AutoTooltipButton(title1);
    button1.setDefaultButton(true);
    button1.getStyleClass().add("action-button");
    button1.setDefaultButton(true);
    button1.setMaxWidth(Double.MAX_VALUE);
    HBox.setHgrow(button1, Priority.ALWAYS);

    Button button2 = new AutoTooltipButton(title2);
    button2.setMaxWidth(Double.MAX_VALUE);
    HBox.setHgrow(button2, Priority.ALWAYS);

    hBox.getChildren().addAll(button1, button2);

    final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, labelText, hBox, top);

    return new Tuple3<>(topLabelWithVBox.first, button1, button2);
}
 
Example 3
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Tuple4<Label, TextField, RadioButton, RadioButton> addTopLabelTextFieldRadioButtonRadioButton(GridPane gridPane,
                                                                                                            int rowIndex,
                                                                                                            ToggleGroup toggleGroup,
                                                                                                            String title,
                                                                                                            String textFieldTitle,
                                                                                                            String radioButtonTitle1,
                                                                                                            String radioButtonTitle2,
                                                                                                            double top) {
    TextField textField = new BisqTextField();
    textField.setPromptText(textFieldTitle);

    RadioButton radioButton1 = new AutoTooltipRadioButton(radioButtonTitle1);
    radioButton1.setToggleGroup(toggleGroup);
    radioButton1.setPadding(new Insets(6, 0, 0, 0));

    RadioButton radioButton2 = new AutoTooltipRadioButton(radioButtonTitle2);
    radioButton2.setToggleGroup(toggleGroup);
    radioButton2.setPadding(new Insets(6, 0, 0, 0));

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(textField, radioButton1, radioButton2);

    final Tuple2<Label, VBox> labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top);

    return new Tuple4<>(labelVBoxTuple2.first, textField, radioButton1, radioButton2);
}
 
Example 4
Source File: TaskBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
public TaskBar() {
    taskBarContentPane = new HBox();
    taskBarContentPane.setSpacing(3);
    taskBarContentPane.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBarContentPane.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBarContentPane.setAlignment(Pos.CENTER_LEFT);

    taskBar = new ScrollPane(taskBarContentPane);
    taskBar.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBar.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
    taskBar.setVbarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy.NEVER);
    taskBar.setVmax(0);
    taskBar.getStyleClass().add("desktoppane-taskbar");

    taskBar.visibleProperty().bind(visible);
    taskBar.managedProperty().bind(visible);

    taskBarContentPane.widthProperty().addListener((o, v, n) -> {
        Platform.runLater(() -> {
            if (n.doubleValue() <= taskBar.getWidth()) {
                taskBar.setMaxHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
                taskBar.setPrefHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
                taskBar.setMinHeight(TASKBAR_HEIGHT_WITHOUT_SCROLL);
            } else {
                taskBar.setMaxHeight(TASKBAR_HEIGHT_WITH_SCROLL);
                taskBar.setPrefHeight(TASKBAR_HEIGHT_WITH_SCROLL);
                taskBar.setMinHeight(TASKBAR_HEIGHT_WITH_SCROLL);
            }
        });
    });
}
 
Example 5
Source File: SeparatedPhaseBars.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public SeparatedPhaseBars(List<SeparatedPhaseBarsItem> items) {
    this.items = items;
    setSpacing(10);

    HBox titlesBars = new HBox();
    titlesBars.setSpacing(5);
    getChildren().add(titlesBars);

    HBox progressBars = new HBox();
    progressBars.setSpacing(5);
    getChildren().add(progressBars);

    items.forEach(item -> {
        String text = item.phase.name().startsWith("BREAK") ? "" : Res.get("dao.phase.separatedPhaseBar." + item.phase);
        Label titleLabel = new Label(text);
        titleLabel.setEllipsisString("");
        titleLabel.setAlignment(Pos.CENTER);
        item.setTitleLabel(titleLabel);
        titlesBars.getChildren().addAll(titleLabel);

        ProgressBar progressBar = new JFXProgressBar();
        progressBar.setMinHeight(9);
        progressBar.setMaxHeight(9);
        progressBar.progressProperty().bind(item.progressProperty);
        progressBar.setOpacity(item.isShowBlocks() ? 1 : 0.25);
        progressBars.getChildren().add(progressBar);
        item.setProgressBar(progressBar);
    });

    widthProperty().addListener((observable, oldValue, newValue) -> {
        updateWidth((double) newValue);
    });
}
 
Example 6
Source File: ViewNumberChart.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Node constructContent() {
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);   
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    level = new Label();
    level.setAlignment(Pos.CENTER_RIGHT);
    level.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    level.getStyleClass().add("unitmaintext");
    HBox.setHgrow(level, Priority.SOMETIMES);
    
    boxview.getChildren().add(level);
    
    areachart = new ChartNode();
    StackPane chart = areachart.getNode();
    chart.setMinSize(40.0, 50.0);
    chart.setPrefSize(40.0, 50.0);
    chart.setPadding(Insets.EMPTY);
    
    StackPane stack = new StackPane(chart);
    VBox.setVgrow(stack, Priority.SOMETIMES);   
    stack.setPadding(new Insets(0.0, 0.0, 0.0, 3.0));
    vboxroot.getChildren().addAll(boxview, stack);
    
    initialize();
    return vboxroot;
}
 
Example 7
Source File: FlipClock.java    From Enzo with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    HBox dayBox = new HBox();
    dayBox.setSpacing(0);
    dayBox.getChildren().addAll(dayLeft, dayMid, dayRight);
    dayBox.setLayoutX(12);
    dayBox.setLayoutY(76);

    HBox dateBox = new HBox();
    dateBox.setSpacing(0);
    dateBox.getChildren().addAll(dateLeft, dateRight);
    dateBox.setLayoutX(495);
    dateBox.setLayoutY(76);

    HBox monthBox = new HBox();
    monthBox.setSpacing(0);
    monthBox.getChildren().addAll(monthLeft, monthMid, monthRight);
    monthBox.setLayoutX(833);
    monthBox.setLayoutY(76);

    HBox clockBox = new HBox();
    clockBox.setSpacing(0);
    HBox.setMargin(hourRight, new Insets(0, 40, 0, 0));
    HBox.setMargin(minRight, new Insets(0, 40, 0, 0));
    clockBox.getChildren().addAll(hourLeft, hourRight, minLeft, minRight, secLeft, secRight);
    clockBox.setLayoutY(375);

    Pane pane = new Pane(dayBox, dateBox, monthBox, clockBox);
    pane.setPadding(new Insets(10, 10, 10, 10));

    Scene scene = new Scene(pane, 1280, 800, new LinearGradient(0, 0, 0, 800, false, CycleMethod.NO_CYCLE,
                                                                new Stop(0.0, Color.rgb(28, 27, 22)),
                                                                new Stop(0.25, Color.rgb(38, 37, 32)),
                                                                new Stop(1.0, Color.rgb(28, 27, 22))));
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 8
Source File: ColorButtonSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
Example 9
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static <T, R> Tuple3<Label, ComboBox<T>, ComboBox<R>> addTopLabelComboBoxComboBox(GridPane gridPane,
                                                                                         int rowIndex,
                                                                                         String title,
                                                                                         double top) {
    HBox hBox = new HBox();
    hBox.setSpacing(10);

    ComboBox<T> comboBox1 = new JFXComboBox<>();
    ComboBox<R> comboBox2 = new JFXComboBox<>();
    hBox.getChildren().addAll(comboBox1, comboBox2);

    final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top);

    return new Tuple3<>(topLabelWithVBox.first, comboBox1, comboBox2);
}
 
Example 10
Source File: Main.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public ProgressDialog(String dialogTitle, String dialogMessage, final Task<?> task) {
	stage.setTitle(dialogTitle);
	stage.initModality(Modality.APPLICATION_MODAL);

	pb.setProgress(-1F);
	pin.setProgress(-1F);

	messageLabel.setText(dialogMessage);

	final HBox hb = new HBox();
	hb.setSpacing(5);
	hb.setAlignment(Pos.CENTER);
	hb.getChildren().addAll(pb, pin);

	pb.prefWidthProperty().bind(hb.widthProperty().subtract(hb.getSpacing() * 6));

	final BorderPane bp = new BorderPane();
	bp.setTop(messageLabel);
	bp.setBottom(hb);

	final Scene scene = new Scene(bp);

	stage.setScene(scene);
	stage.show();

	pb.progressProperty().bind(task.progressProperty());
	pin.progressProperty().bind(task.progressProperty());
}
 
Example 11
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);
}
 
Example 12
Source File: DateTimeEditorFactory.java    From constellation with Apache License 2.0 4 votes vote down vote up
@Override
protected Node createEditorControls() {
    final GridPane controls = new GridPane();
    controls.setAlignment(Pos.CENTER);
    controls.setVgap(CONTROLS_DEFAULT_VERTICAL_SPACING);

    noValueCheckBox = new CheckBox(NO_VALUE_LABEL);
    noValueCheckBox.setAlignment(Pos.CENTER);
    noValueCheckBox.selectedProperty().addListener((v, o, n) -> {
        datePicker.setDisable(noValueCheckBox.isSelected());
        hourSpinner.setDisable(noValueCheckBox.isSelected());
        minSpinner.setDisable(noValueCheckBox.isSelected());
        secSpinner.setDisable(noValueCheckBox.isSelected());
        milliSpinner.setDisable(noValueCheckBox.isSelected());
        timeZoneComboBox.setDisable(noValueCheckBox.isSelected());
        update();
    });

    final ObservableList<ZoneId> timeZones = FXCollections.observableArrayList();
    ZoneId.getAvailableZoneIds().forEach(id -> {
        timeZones.add(ZoneId.of(id));
    });
    timeZoneComboBox = new ComboBox<>();
    timeZoneComboBox.setItems(timeZones.sorted(zoneIdComparator));
    final Callback<ListView<ZoneId>, ListCell<ZoneId>> cellFactory = (final ListView<ZoneId> p) -> new ListCell<ZoneId>() {
        @Override
        protected void updateItem(final ZoneId item, boolean empty) {
            super.updateItem(item, empty);
            if (item != null) {
                setText(TimeZoneUtilities.getTimeZoneAsString(currentValue == null ? null : currentValue.toLocalDateTime(), item));
            }
        }
    };

    final Label timeZoneComboBoxLabel = new Label("Time Zone:");
    timeZoneComboBoxLabel.setId(LABEL_ID);
    timeZoneComboBoxLabel.setLabelFor(timeZoneComboBoxLabel);

    timeZoneComboBox.setCellFactory(cellFactory);
    timeZoneComboBox.setButtonCell(cellFactory.call(null));
    timeZoneComboBox.getSelectionModel().select(TimeZoneUtilities.UTC);
    timeZoneComboBox.getSelectionModel().selectedItemProperty().addListener(updateTimeFromZone);

    final HBox timeZoneHbox = new HBox(timeZoneComboBoxLabel, timeZoneComboBox);
    timeZoneHbox.setSpacing(5);
    final HBox timeSpinnerContainer = createTimeSpinners();

    controls.addRow(0, timeSpinnerContainer);
    controls.addRow(1, timeZoneHbox);
    controls.addRow(2, noValueCheckBox);
    return controls;
}
 
Example 13
Source File: OfferBookView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void initialize() {
    root.setPadding(new Insets(15, 15, 5, 15));

    final TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 2, Res.get("offerbook.availableOffers"));
    titledGroupBg.getStyleClass().add("last");

    HBox hBox = new HBox();
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.setSpacing(35);
    hBox.setPadding(new Insets(10, 0, 0, 0));

    final Tuple3<VBox, Label, AutocompleteComboBox<TradeCurrency>> currencyBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
            Res.get("offerbook.filterByCurrency"));
    final Tuple3<VBox, Label, AutocompleteComboBox<PaymentMethod>> paymentBoxTuple = FormBuilder.addTopLabelAutocompleteComboBox(
            Res.get("offerbook.filterByPaymentMethod"));

    createOfferButton = new AutoTooltipButton();
    createOfferButton.setMinHeight(40);
    createOfferButton.setGraphicTextGap(10);
    AnchorPane.setRightAnchor(createOfferButton, 0d);
    AnchorPane.setBottomAnchor(createOfferButton, 0d);

    hBox.getChildren().addAll(currencyBoxTuple.first, paymentBoxTuple.first, createOfferButton);
    AnchorPane.setLeftAnchor(hBox, 0d);
    AnchorPane.setTopAnchor(hBox, 0d);
    AnchorPane.setBottomAnchor(hBox, 0d);

    AnchorPane anchorPane = new AnchorPane();
    anchorPane.getChildren().addAll(hBox, createOfferButton);

    GridPane.setHgrow(anchorPane, Priority.ALWAYS);
    GridPane.setRowIndex(anchorPane, gridRow);
    GridPane.setColumnSpan(anchorPane, 2);
    GridPane.setMargin(anchorPane, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    root.getChildren().add(anchorPane);

    currencyComboBox = currencyBoxTuple.third;

    paymentMethodComboBox = paymentBoxTuple.third;
    paymentMethodComboBox.setCellFactory(GUIUtil.getPaymentMethodCellFactory());

    tableView = new TableView<>();

    GridPane.setRowIndex(tableView, ++gridRow);
    GridPane.setColumnIndex(tableView, 0);
    GridPane.setColumnSpan(tableView, 2);
    GridPane.setMargin(tableView, new Insets(10, 0, -10, 0));
    GridPane.setVgrow(tableView, Priority.ALWAYS);
    root.getChildren().add(tableView);

    marketColumn = getMarketColumn();

    priceColumn = getPriceColumn();
    tableView.getColumns().add(priceColumn);
    amountColumn = getAmountColumn();
    tableView.getColumns().add(amountColumn);
    volumeColumn = getVolumeColumn();
    tableView.getColumns().add(volumeColumn);
    paymentMethodColumn = getPaymentMethodColumn();
    tableView.getColumns().add(paymentMethodColumn);
    signingStateColumn = getSigningStateColumn();
    tableView.getColumns().add(signingStateColumn);
    avatarColumn = getAvatarColumn();
    tableView.getColumns().add(getActionColumn());
    tableView.getColumns().add(avatarColumn);

    tableView.getSortOrder().add(priceColumn);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.multipleOffers")));
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);

    marketColumn.setComparator(Comparator.comparing(
            o -> CurrencyUtil.getCurrencyPair(o.getOffer().getCurrencyCode()),
            Comparator.nullsFirst(Comparator.naturalOrder())
    ));
    priceColumn.setComparator(Comparator.comparing(o -> o.getOffer().getPrice(), Comparator.nullsFirst(Comparator.naturalOrder())));
    amountColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinAmount()));
    volumeColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinVolume(), Comparator.nullsFirst(Comparator.naturalOrder())));
    paymentMethodColumn.setComparator(Comparator.comparing(o -> o.getOffer().getPaymentMethod()));
    avatarColumn.setComparator(Comparator.comparing(o -> o.getOffer().getOwnerNodeAddress().getFullAddress()));

    nrOfOffersLabel = new AutoTooltipLabel("");
    nrOfOffersLabel.setId("num-offers");
    GridPane.setHalignment(nrOfOffersLabel, HPos.LEFT);
    GridPane.setVgrow(nrOfOffersLabel, Priority.NEVER);
    GridPane.setValignment(nrOfOffersLabel, VPos.TOP);
    GridPane.setRowIndex(nrOfOffersLabel, ++gridRow);
    GridPane.setColumnIndex(nrOfOffersLabel, 0);
    GridPane.setMargin(nrOfOffersLabel, new Insets(10, 0, 0, 0));
    root.getChildren().add(nrOfOffersLabel);

    offerListListener = c -> nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size()));

    // Fixes incorrect ordering of Available offers:
    // https://github.com/bisq-network/bisq-desktop/issues/588
    priceFeedUpdateCounterListener = (observable, oldValue, newValue) -> tableView.sort();
}
 
Example 14
Source File: BuyerStep4View.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void addContent() {
    gridPane.getColumnConstraints().get(1).setHgrow(Priority.SOMETIMES);

    addTitledGroupBg(gridPane, gridRow, 5, Res.get("portfolio.pending.step5_buyer.groupTitle"), 0);
    addCompactTopLabelTextField(gridPane, gridRow, getBtcTradeAmountLabel(), model.getTradeVolume(), Layout.TWICE_FIRST_ROW_DISTANCE);

    addCompactTopLabelTextField(gridPane, ++gridRow, getFiatTradeAmountLabel(), model.getFiatVolume());
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.refunded"), model.getSecurityDeposit());
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.tradeFee"), model.getTradeFee());
    final String miningFee = model.dataModel.isMaker() ?
            Res.get("portfolio.pending.step5_buyer.makersMiningFee") :
            Res.get("portfolio.pending.step5_buyer.takersMiningFee");
    addCompactTopLabelTextField(gridPane, ++gridRow, miningFee, model.getTxFee());
    withdrawTitledGroupBg = addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("portfolio.pending.step5_buyer.withdrawBTC"), Layout.COMPACT_GROUP_DISTANCE);
    withdrawTitledGroupBg.getStyleClass().add("last");
    addCompactTopLabelTextField(gridPane, gridRow, Res.get("portfolio.pending.step5_buyer.amount"), model.getPayoutAmount(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    withdrawAddressTextField = addInputTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.withdrawToAddress"));
    withdrawAddressTextField.setManaged(false);
    withdrawAddressTextField.setVisible(false);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    useSavingsWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.moveToBisqWallet"));
    useSavingsWalletButton.setDefaultButton(true);
    useSavingsWalletButton.getStyleClass().add("action-button");
    Label label = new AutoTooltipLabel(Res.get("shared.OR"));
    label.setPadding(new Insets(5, 0, 0, 0));
    withdrawToExternalWalletButton = new AutoTooltipButton(Res.get("portfolio.pending.step5_buyer.withdrawExternal"));
    withdrawToExternalWalletButton.setDefaultButton(false);
    hBox.getChildren().addAll(useSavingsWalletButton, label, withdrawToExternalWalletButton);
    GridPane.setRowIndex(hBox, ++gridRow);
    GridPane.setMargin(hBox, new Insets(5, 10, 0, 0));
    gridPane.getChildren().add(hBox);

    useSavingsWalletButton.setOnAction(e -> {
        handleTradeCompleted();
        model.dataModel.tradeManager.addTradeToClosedTrades(trade);
    });
    withdrawToExternalWalletButton.setOnAction(e -> {
        onWithdrawal();
    });

    String key = "tradeCompleted" + trade.getId();
    if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
        DontShowAgainLookup.dontShowAgain(key, true);
        new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
                .notification(Res.get("notification.tradeCompleted.msg"))
                .autoClose()
                .show();
    }
}
 
Example 15
Source File: Overlay.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
protected void addButtons() {
    if (!hideCloseButton) {
        closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText);
        closeButton.getStyleClass().add("compact-button");
        closeButton.setOnAction(event -> doClose());
        closeButton.setMinWidth(70);
        HBox.setHgrow(closeButton, Priority.SOMETIMES);
    }

    Pane spacer = new Pane();

    if (buttonAlignment == HPos.RIGHT) {
        HBox.setHgrow(spacer, Priority.ALWAYS);
        spacer.setMaxWidth(Double.MAX_VALUE);
    }

    buttonBox = new HBox();

    GridPane.setHalignment(buttonBox, buttonAlignment);
    GridPane.setRowIndex(buttonBox, ++rowIndex);
    GridPane.setColumnSpan(buttonBox, 2);
    GridPane.setMargin(buttonBox, new Insets(buttonDistance, 0, 0, 0));
    gridPane.getChildren().add(buttonBox);

    if (actionHandlerOptional.isPresent() || actionButtonText != null) {
        actionButton = new AutoTooltipButton(actionButtonText == null ? Res.get("shared.ok") : actionButtonText);

        if (!disableActionButton)
            actionButton.setDefaultButton(true);
        else
            actionButton.setDisable(true);

        HBox.setHgrow(actionButton, Priority.SOMETIMES);

        actionButton.getStyleClass().add("action-button");
        //TODO app wide focus
        //actionButton.requestFocus();

        if (!disableActionButton) {
            actionButton.setOnAction(event -> {
                hide();
                actionHandlerOptional.ifPresent(Runnable::run);
            });
        }

        buttonBox.setSpacing(10);

        buttonBox.setAlignment(Pos.CENTER);

        if (buttonAlignment == HPos.RIGHT)
            buttonBox.getChildren().add(spacer);

        buttonBox.getChildren().addAll(actionButton);

        if (secondaryActionButtonText != null && secondaryActionHandlerOptional.isPresent()) {
            secondaryActionButton = new AutoTooltipButton(secondaryActionButtonText);
            secondaryActionButton.setOnAction(event -> {
                hide();
                secondaryActionHandlerOptional.ifPresent(Runnable::run);
            });

            buttonBox.getChildren().add(secondaryActionButton);
        }

        if (!hideCloseButton)
            buttonBox.getChildren().add(closeButton);
    } else if (!hideCloseButton) {
        closeButton.setDefaultButton(true);
        buttonBox.getChildren().addAll(spacer, closeButton);
    }
}
 
Example 16
Source File: ColorSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public ColorSample() {
    super(260,90);
    
    VBox vBox = new VBox();
    vBox.setSpacing(10);
    
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(
            createRectangle(Color.hsb(  0.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb( 30.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb( 60.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(120.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(160.0, 1.0, 1.0)), // hue, saturation, brightness                
            createRectangle(Color.hsb(200.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(240.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(280.0, 1.0, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(320.0, 1.0, 1.0))  // hue, saturation, brightness
            );

    HBox hBox2 = new HBox();
    hBox2.setSpacing(10);
    hBox2.getChildren().addAll(
            createRectangle(Color.hsb(  0.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb( 30.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb( 60.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(120.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(160.0, 0.5, 1.0)), // hue, saturation, brightness                
            createRectangle(Color.hsb(200.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(240.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(280.0, 0.5, 1.0)), // hue, saturation, brightness
            createRectangle(Color.hsb(320.0, 0.5, 1.0))  // hue, saturation, brightness
            );
    
    HBox hBox3 = new HBox();
    hBox3.setSpacing(10);
    hBox3.getChildren().addAll(
            createRectangle(Color.hsb(  0.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb( 30.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb( 60.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb(120.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb(160.0, 1.0, 0.5)), // hue, saturation, brightness                
            createRectangle(Color.hsb(200.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb(240.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb(280.0, 1.0, 0.5)), // hue, saturation, brightness
            createRectangle(Color.hsb(320.0, 1.0, 0.5))  // hue, saturation, brightness
            );
    
    HBox hBox4 = new HBox();
    hBox4.setSpacing(10);
    hBox4.getChildren().addAll(
            createRectangle(Color.BLACK), //predefined color
            createRectangle(Color.hsb(0, 0, 0.1)), //defined by hue - saturation - brightness
            createRectangle(new Color(0.2, 0.2, 0.2, 1)), //define color as new instance of color
            createRectangle(Color.color(0.3, 0.3, 0.3)), //standard constructor
            createRectangle(Color.rgb(102, 102, 102)), //define color by rgb
            createRectangle(Color.web("#777777")), //define color by hex web value
            createRectangle(Color.gray(0.6)), //define gray color
            createRectangle(Color.grayRgb(179)), //define gray color
            createRectangle(Color.grayRgb(179, 0.5)) //opacity can be adjusted in all constructors
            );
    
    vBox.getChildren().add(hBox);
    vBox.getChildren().add(hBox2);
    vBox.getChildren().add(hBox3);
    vBox.getChildren().add(hBox4);
    
    // show the rectangles
    getChildren().add(vBox);
}
 
Example 17
Source File: ListController.java    From examples-javafx-repos1 with Apache License 2.0 4 votes vote down vote up
@FXML
public void initialize() {

    String[][] buttonDefs = {
            {"Edit", "Editting"},
            {"Run", "Running"},
            {"Send", "Sending"}
    };

    String[][] data = {
            {"A", "ID: A001"},
            {"B", "ID: B001"},
            {"C", "ID: C001"},
            {"D", "ID: D001"},
            {"E", "ID: E001"}
    };

    //
    // Renders
    //
    // A | Edit A button | Run A button | Send A button
    // B | Edit B button | Run B button | Send B button
    // ...
    //

    for( String[] rec : data ) {

        HBox hbox = new HBox();
        hbox.setSpacing(20.0d);

        Label label= new Label( rec[0] );
        hbox.getChildren().add(label);

        for( String[] buttonDef : buttonDefs ) {
            Button btn = new Button(buttonDef[0]);
            btn.getProperties().put(PROP_COMMAND_MESSAGE, buttonDef[1]);
            btn.setUserData(rec[1]);
            btn.setOnAction(commandHandler);
            hbox.getChildren().add(btn);
        }

        lvButtons.getItems().add( hbox );
    }
}
 
Example 18
Source File: PropertyCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected Pair<Node, Subscription> getNonEditingGraphic(PropertyDescriptorSpec spec) {

    Subscription sub = Subscription.EMPTY;

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    Label label = new Label();

    label.textProperty().bind(spec.nameProperty()
                                  .filter(StringUtils::isNotBlank)
                                  .orElseConst("(no name)"));

    sub = sub.and(label.textProperty()::unbind);
    sub = sub.and(ControlUtil.registerDoubleClickListener(label, this::doStartEdit));

    Label typeLabel = new Label();
    typeLabel.textProperty().bind(spec.typeIdProperty().map(PropertyTypeId::getStringId).map(it -> ": " + it));

    sub = sub.and(typeLabel.textProperty()::unbind);

    Pane spacer = ControlUtil.spacerPane();

    Button edit = new Button();
    edit.setGraphic(new FontIcon("fas-ellipsis-h"));
    edit.getStyleClass().addAll(DETAILS_BUTTON_CLASS, "icon-button");
    Tooltip.install(edit, new Tooltip("Edit property..."));


    edit.setOnAction(e -> {
        myEditPopover.rebind(spec);
        myEditPopover.showOrFocus(p -> PopOverUtil.showAt(p, owner, this));
        view.requestFocus();
    });

    sub = sub.and(() -> edit.setOnAction(null));

    Button delete = new Button();
    delete.setGraphic(new FontIcon("fas-trash-alt"));
    delete.getStyleClass().addAll(DELETE_BUTTON_CLASS, "icon-button");
    Tooltip.install(delete, new Tooltip("Remove property"));
    delete.setOnAction(e -> {
        getItems().remove(spec);
        if (Objects.equals(myEditPopover.getIdentity(), spec)) {
            myEditPopover.rebind(null);
            myEditPopover.hide();
        }
        view.requestFocus();
    });

    sub = sub.and(() -> delete.setOnAction(null));


    hBox.getChildren().setAll(label, typeLabel, spacer, delete, edit);
    hBox.setAlignment(Pos.CENTER_LEFT);

    return new Pair<>(hBox, sub);
}
 
Example 19
Source File: DisputeSummaryWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addReasonControls() {
    reasonWasBugRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.bug"));
    reasonWasUsabilityIssueRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.usability"));
    reasonProtocolViolationRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.protocolViolation"));
    reasonNoReplyRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.noReply"));
    reasonWasScamRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.scam"));
    reasonWasBankRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.bank"));
    reasonWasOtherRadioButton = new AutoTooltipRadioButton(Res.get("disputeSummaryWindow.reason.other"));

    HBox feeRadioButtonPane = new HBox();
    feeRadioButtonPane.setSpacing(20);
    feeRadioButtonPane.getChildren().addAll(reasonWasBugRadioButton, reasonWasUsabilityIssueRadioButton,
            reasonProtocolViolationRadioButton, reasonNoReplyRadioButton,
            reasonWasBankRadioButton, reasonWasScamRadioButton, reasonWasOtherRadioButton);

    VBox vBox = addTopLabelWithVBox(gridPane, ++rowIndex,
            Res.get("disputeSummaryWindow.reason"),
            feeRadioButtonPane, 10).second;
    GridPane.setColumnSpan(vBox, 2);

    reasonToggleGroup = new ToggleGroup();
    reasonWasBugRadioButton.setToggleGroup(reasonToggleGroup);
    reasonWasUsabilityIssueRadioButton.setToggleGroup(reasonToggleGroup);
    reasonProtocolViolationRadioButton.setToggleGroup(reasonToggleGroup);
    reasonNoReplyRadioButton.setToggleGroup(reasonToggleGroup);
    reasonWasScamRadioButton.setToggleGroup(reasonToggleGroup);
    reasonWasOtherRadioButton.setToggleGroup(reasonToggleGroup);
    reasonWasBankRadioButton.setToggleGroup(reasonToggleGroup);

    reasonToggleSelectionListener = (observable, oldValue, newValue) -> {
        if (newValue == reasonWasBugRadioButton)
            disputeResult.setReason(DisputeResult.Reason.BUG);
        else if (newValue == reasonWasUsabilityIssueRadioButton)
            disputeResult.setReason(DisputeResult.Reason.USABILITY);
        else if (newValue == reasonProtocolViolationRadioButton)
            disputeResult.setReason(DisputeResult.Reason.PROTOCOL_VIOLATION);
        else if (newValue == reasonNoReplyRadioButton)
            disputeResult.setReason(DisputeResult.Reason.NO_REPLY);
        else if (newValue == reasonWasScamRadioButton)
            disputeResult.setReason(DisputeResult.Reason.SCAM);
        else if (newValue == reasonWasBankRadioButton)
            disputeResult.setReason(DisputeResult.Reason.BANK_PROBLEMS);
        else if (newValue == reasonWasOtherRadioButton)
            disputeResult.setReason(DisputeResult.Reason.OTHER);
    };
    reasonToggleGroup.selectedToggleProperty().addListener(reasonToggleSelectionListener);
}
 
Example 20
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addPaymentGroup() {
    paymentTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 1, Res.get("shared.selectTradingAccount"));
    GridPane.setColumnSpan(paymentTitledGroupBg, 2);

    paymentGroupBox = new HBox();
    paymentGroupBox.setAlignment(Pos.CENTER_LEFT);
    paymentGroupBox.setSpacing(62);
    paymentGroupBox.setPadding(new Insets(10, 0, 18, 0));

    final Tuple3<VBox, Label, ComboBox<PaymentAccount>> tradingAccountBoxTuple = addTopLabelComboBox(
            Res.get("shared.tradingAccount"), Res.get("shared.selectTradingAccount"));
    final Tuple3<VBox, Label, ComboBox<TradeCurrency>> currencyBoxTuple = addTopLabelComboBox(
            Res.get("shared.currency"), Res.get("list.currency.select"));

    currencySelection = currencyBoxTuple.first;
    paymentGroupBox.getChildren().addAll(tradingAccountBoxTuple.first, currencySelection);

    GridPane.setRowIndex(paymentGroupBox, gridRow);
    GridPane.setColumnSpan(paymentGroupBox, 2);
    GridPane.setMargin(paymentGroupBox, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(paymentGroupBox);

    paymentAccountsComboBox = tradingAccountBoxTuple.third;
    paymentAccountsComboBox.setMinWidth(300);
    editOfferElements.add(tradingAccountBoxTuple.first);

    // we display either currencyComboBox (multi currency account) or currencyTextField (single)
    currencyComboBox = currencyBoxTuple.third;
    editOfferElements.add(currencySelection);
    currencyComboBox.setConverter(new StringConverter<>() {
        @Override
        public String toString(TradeCurrency tradeCurrency) {
            return tradeCurrency.getNameAndCode();
        }

        @Override
        public TradeCurrency fromString(String s) {
            return null;
        }
    });

    final Tuple3<Label, TextField, VBox> currencyTextFieldTuple = addTopLabelTextField(gridPane, gridRow, Res.get("shared.currency"), "", 5d);
    currencyTextField = currencyTextFieldTuple.second;
    currencyTextFieldBox = currencyTextFieldTuple.third;
    currencyTextFieldBox.setVisible(false);
    editOfferElements.add(currencyTextFieldBox);

    paymentGroupBox.getChildren().add(currencyTextFieldBox);
}