Search in sources :

Example 21 with RadioButton

use of javafx.scene.control.RadioButton in project bisq-desktop by bisq-network.

the class FeeOptionWindow method addContent.

private void addContent() {
    Label label = addLabel(gridPane, ++rowIndex, Res.get("feeOptionWindow.info"));
    GridPane.setColumnSpan(label, 2);
    GridPane.setHalignment(label, HPos.LEFT);
    toggleGroup = new ToggleGroup();
    Tuple3<Label, RadioButton, RadioButton> tuple = addLabelRadioButtonRadioButton(gridPane, ++rowIndex, toggleGroup, Res.get("feeOptionWindow.optionsLabel"), "BTC", "BSQ");
    RadioButton radioButtonBTC = tuple.second;
    RadioButton radioButtonBSQ = tuple.third;
    makerFeeTextField = addLabelTextField(gridPane, ++rowIndex, Res.getWithCol("createOffer.currencyForFee"), makerFeeWithCodeProperty.get()).second;
    toggleChangeListener = (observable, oldValue, newValue) -> {
        final boolean isBtc = newValue == radioButtonBTC;
        selectionChangedHandler.accept(isBtc);
        if (!isBsqForFeeAvailable && !isBtc) {
            if (missingBsq != null) {
                // We don't call hide() because we want to keep the blurred bg
                if (stage != null)
                    stage.hide();
                else
                    log.warn("Stage is null");
                cleanup();
                onHidden();
                // noinspection unchecked
                new Popup().warning(missingBsq).actionButtonTextWithGoTo("navigation.dao.wallet.receive").onAction(() -> {
                    UserThread.runAfter(() -> {
                        hide();
                        navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqReceiveView.class);
                    }, 100, TimeUnit.MILLISECONDS);
                }).closeButtonText(Res.get("feeOptionWindow.useBTC")).onClose(() -> {
                    selectionChangedHandler.accept(true);
                    closeHandler.run();
                }).show();
            }
            UserThread.execute(() -> {
                toggleGroup.selectToggle(radioButtonBTC);
                radioButtonBSQ.setDisable(true);
            });
        }
    };
    toggleGroup.selectedToggleProperty().addListener(toggleChangeListener);
    toggleGroup.selectToggle(!isBsqForFeeAvailable || isCurrencyForMakerFeeBtc ? radioButtonBTC : radioButtonBSQ);
    makerFeeTextField.textProperty().bind(makerFeeWithCodeProperty);
}
Also used : MainView(bisq.desktop.main.MainView) DaoView(bisq.desktop.main.dao.DaoView) BsqReceiveView(bisq.desktop.main.dao.wallet.receive.BsqReceiveView) ToggleGroup(javafx.scene.control.ToggleGroup) Popup(bisq.desktop.main.overlays.popups.Popup) FormBuilder.addLabel(bisq.desktop.util.FormBuilder.addLabel) Label(javafx.scene.control.Label) FormBuilder.addLabelRadioButtonRadioButton(bisq.desktop.util.FormBuilder.addLabelRadioButtonRadioButton) RadioButton(javafx.scene.control.RadioButton) BsqWalletView(bisq.desktop.main.dao.wallet.BsqWalletView)

Example 22 with RadioButton

use of javafx.scene.control.RadioButton in project FXGL by AlmasB.

the class InterpolatorSample method initUI.

@Override
protected void initUI() {
    VBox vbox = new VBox(5);
    for (EasingInterpolator interpolator : Interpolators.values()) {
        Button btn = new Button(interpolator.toString());
        btn.disableProperty().bind(getGameState().booleanProperty("canPlay").not());
        btn.setOnAction(e -> playAnimation(interpolator));
        vbox.getChildren().add(btn);
    }
    RadioButton btn1 = new RadioButton("Ease In");
    RadioButton btn2 = new RadioButton("Ease Out");
    RadioButton btn3 = new RadioButton("Ease In Out");
    btn1.setToggleGroup(group);
    btn2.setToggleGroup(group);
    btn3.setToggleGroup(group);
    btn2.setSelected(true);
    RadioButton btn4 = new RadioButton("Translate");
    RadioButton btn5 = new RadioButton("Scale");
    RadioButton btn6 = new RadioButton("Rotate");
    btn4.setToggleGroup(group2);
    btn5.setToggleGroup(group2);
    btn6.setToggleGroup(group2);
    btn4.setSelected(true);
    vbox.getChildren().addAll(btn1, btn2, btn3, btn4, btn5, btn6);
    vbox.setTranslateX(650);
    getGameScene().addUINode(vbox);
}
Also used : EasingInterpolator(com.almasb.fxgl.animation.EasingInterpolator) Button(javafx.scene.control.Button) RadioButton(javafx.scene.control.RadioButton) RadioButton(javafx.scene.control.RadioButton) VBox(javafx.scene.layout.VBox)

Example 23 with RadioButton

use of javafx.scene.control.RadioButton in project OTP2_R6_svaap by JNuutinen.

the class SettingsMenu method makeBackgroundSettings.

/**
 * Apumetodi, joka rakentaa taustateeman asetukset.
 *
 * @param messages Lokalisoidut merkkijonot.
 */
private void makeBackgroundSettings(ResourceBundle messages) {
    backgroundColorText = new Text(messages.getString("background"));
    backgroundColorText.setStyle("-fx-fill: white");
    final ToggleGroup bgButtons = new ToggleGroup();
    normalBgButton = new RadioButton(messages.getString("normal"));
    normalBgButton.setTextFill(Color.WHITE);
    normalBgButton.setToggleGroup(bgButtons);
    normalBgButton.setSelected(true);
    normalBgButton.setUserData(NormalSpaceTheme.getInstance());
    redBgButton = new RadioButton(messages.getString("red"));
    redBgButton.setTextFill(Color.WHITE);
    redBgButton.setToggleGroup(bgButtons);
    redBgButton.setUserData(RedSpaceTheme.getInstance());
    greenBgButton = new RadioButton(messages.getString("green"));
    greenBgButton.setTextFill(Color.WHITE);
    greenBgButton.setToggleGroup(bgButtons);
    greenBgButton.setUserData(GreenSpaceTheme.getInstance());
    purpleBgButton = new RadioButton(messages.getString("purple"));
    purpleBgButton.setTextFill(Color.WHITE);
    purpleBgButton.setToggleGroup(bgButtons);
    purpleBgButton.setUserData(PurpleSpaceTheme.getInstance());
    underWaterBgButton = new RadioButton(messages.getString("water"));
    underWaterBgButton.setTextFill(Color.WHITE);
    underWaterBgButton.setToggleGroup(bgButtons);
    underWaterBgButton.setUserData(UnderwaterTheme.getInstance());
    setBackgroundRadioButtonCallback(bgButtons);
}
Also used : ToggleGroup(javafx.scene.control.ToggleGroup) Text(javafx.scene.text.Text) RadioButton(javafx.scene.control.RadioButton)

Example 24 with RadioButton

use of javafx.scene.control.RadioButton in project selenium_java by sergueik.

the class ComplexFormEx method start.

@SuppressWarnings("restriction")
@Override
public void start(Stage stage) {
    BorderPane root = new BorderPane();
    stage.setTitle(inputData.containsKey("title") ? inputData.get("title") : "Element Locators");
    Scene scene = new Scene(root, 480, 250, Color.WHITE);
    // stage.setScene(new Scene(root, 480, 250, Color.WHITE));
    stage.setScene(scene);
    GridPane gridPane1 = new GridPane();
    GridPane gridPane = new GridPane();
    gridPane.setRowIndex(gridPane, 0);
    gridPane.setColumnIndex(gridPane, 0);
    HBox buttonbarHbox = new HBox(10);
    buttonbarHbox.setPadding(new Insets(10));
    // buttonbarHbox.setSpacing(50);
    // buttonbarHbox.setPadding(new Insets(10, 10, 10, 10));
    // gridPane.setVgap(5);
    gridPane.setRowIndex(buttonbarHbox, 1);
    gridPane.setColumnIndex(buttonbarHbox, 0);
    // Save button
    Button saveButton = new Button("Save");
    saveButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Saved");
            Stage stage = (Stage) ((Button) (event.getSource())).getScene().getWindow();
            stage.close();
        }
    });
    saveButton.setDefaultButton(true);
    // Delete button
    Button deleteButton = new Button("Delete");
    deleteButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Deleted");
            Stage stage = (Stage) ((Button) (event.getSource())).getScene().getWindow();
            stage.close();
        }
    });
    // Cancel button
    Button cancelButton = new Button("Cancel");
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Cancel");
            Stage stage = (Stage) ((Button) (event.getSource())).getScene().getWindow();
            stage.close();
        }
    });
    buttonbarHbox.getChildren().addAll(saveButton, deleteButton, cancelButton);
    gridPane.setPadding(new Insets(20, 10, 10, 20));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setStyle("-fx-padding: 10; -fx-border-style: solid inside; -fx-border-width: 2; -fx-border-insets: 5; -fx-border-radius: 0; -fx-border-color: darkgray;");
    ToggleGroup group = new ToggleGroup();
    // CSS
    RadioButton cssButton = new RadioButton("css");
    cssButton.setToggleGroup(group);
    cssButton.setSelected(true);
    gridPane.setHalignment(cssButton, HPos.LEFT);
    gridPane.add(cssButton, 0, 0);
    TextField cssFld = new TextField();
    gridPane.setHalignment(cssFld, HPos.LEFT);
    cssFld.setMaxWidth(Double.MAX_VALUE);
    gridPane.add(cssFld, 1, 0);
    // XPath
    RadioButton xpathButton = new RadioButton("xpath");
    xpathButton.setToggleGroup(group);
    gridPane.setHalignment(xpathButton, HPos.LEFT);
    gridPane.add(xpathButton, 0, 1);
    TextField xpathFld = new TextField();
    gridPane.setHalignment(xpathFld, HPos.LEFT);
    xpathFld.setMaxWidth(Double.MAX_VALUE);
    gridPane.add(xpathFld, 1, 1);
    // ID
    RadioButton idButton = new RadioButton("id");
    idButton.setToggleGroup(group);
    gridPane.setHalignment(idButton, HPos.LEFT);
    gridPane.add(idButton, 0, 2);
    idButton.setDisable(true);
    TextField idFld = new TextField();
    gridPane.setHalignment(idFld, HPos.LEFT);
    idFld.setMaxWidth(Double.MAX_VALUE);
    gridPane.add(idFld, 1, 2);
    idFld.setDisable(true);
    RadioButton textButton = new RadioButton("text");
    textButton.setToggleGroup(group);
    gridPane.setHalignment(textButton, HPos.LEFT);
    gridPane.add(textButton, 0, 3);
    TextField textFld = new TextField();
    gridPane.setHalignment(textFld, HPos.LEFT);
    textFld.setMaxWidth(Double.MAX_VALUE);
    gridPane.add(textFld, 1, 3);
    // constant
    final RowConstraints rowConstraints = new RowConstraints(64);
    // height
    final ColumnConstraints column1Constraints = new ColumnConstraints(100, Control.USE_COMPUTED_SIZE, Control.USE_COMPUTED_SIZE);
    final ColumnConstraints column2Constraints = new ColumnConstraints(250, Control.USE_COMPUTED_SIZE, Double.MAX_VALUE);
    gridPane.getRowConstraints().add(rowConstraints);
    column2Constraints.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(column1Constraints, column2Constraints);
    gridPane.prefWidthProperty().bind(root.widthProperty());
    gridPane1.getChildren().addAll(gridPane, buttonbarHbox);
    gridPane1.prefWidthProperty().bind(root.widthProperty());
    root.getChildren().add(gridPane1);
    scene.setRoot(root);
    stage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) ActionEvent(javafx.event.ActionEvent) ColumnConstraints(javafx.scene.layout.ColumnConstraints) RadioButton(javafx.scene.control.RadioButton) Scene(javafx.scene.Scene) RowConstraints(javafx.scene.layout.RowConstraints) Button(javafx.scene.control.Button) RadioButton(javafx.scene.control.RadioButton) ToggleGroup(javafx.scene.control.ToggleGroup) Stage(javafx.stage.Stage) TextField(javafx.scene.control.TextField)

Example 25 with RadioButton

use of javafx.scene.control.RadioButton in project Smartcity-Smarthouse by TechnionYP5777.

the class SendMessageController method addBoolField.

private void addBoolField(String fieldName) {
    Label label = new Label(fieldName + ":");
    final ToggleGroup group = new ToggleGroup();
    RadioButton rb1 = new RadioButton("Random");
    rb1.setToggleGroup(group);
    rb1.setSelected(true);
    RadioButton rb2 = new RadioButton("True");
    rb2.setToggleGroup(group);
    RadioButton rb3 = new RadioButton("False");
    rb3.setToggleGroup(group);
    HBox hb = new HBox(label, rb1, rb2, rb3);
    hb.setSpacing(3);
    VBox vbox = new VBox(label, hb);
    vbox.setSpacing(5);
    vbox.setPadding(new Insets(10, 0, 0, 10));
    mainPane.getChildren().add(vbox);
    consumers.add(l -> {
        List<Boolean> input = new ArrayList<>();
        RadioButton selectedRadioButton = (RadioButton) group.getSelectedToggle();
        switch(selectedRadioButton.getText()) {
            case "Random":
                input.add(true);
                input.add(false);
                break;
            case "True":
                input.add(true);
                break;
            case "False":
                input.add(false);
                break;
        }
        l.put(fieldName, input);
    });
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) ToggleGroup(javafx.scene.control.ToggleGroup) Label(javafx.scene.control.Label) ArrayList(java.util.ArrayList) RadioButton(javafx.scene.control.RadioButton) VBox(javafx.scene.layout.VBox)

Aggregations

RadioButton (javafx.scene.control.RadioButton)29 Insets (javafx.geometry.Insets)9 ToggleGroup (javafx.scene.control.ToggleGroup)8 Label (javafx.scene.control.Label)7 Button (javafx.scene.control.Button)5 HBox (javafx.scene.layout.HBox)5 VBox (javafx.scene.layout.VBox)5 EasingInterpolator (com.almasb.fxgl.animation.EasingInterpolator)4 JFXRadioButton (com.jfoenix.controls.JFXRadioButton)4 AutoTooltipRadioButton (bisq.desktop.components.AutoTooltipRadioButton)3 ObservableValue (javafx.beans.value.ObservableValue)3 ActionEvent (javafx.event.ActionEvent)3 Node (javafx.scene.Node)3 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)2 RequiredFieldValidator (com.jfoenix.validation.RequiredFieldValidator)2 FontAwesomeIconView (de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView)2 ArrayList (java.util.ArrayList)2 Interpolator (javafx.animation.Interpolator)2 FXCollections (javafx.collections.FXCollections)2 ObservableList (javafx.collections.ObservableList)2