Search in sources :

Example 26 with RadioButton

use of javafx.scene.control.RadioButton in project trex-stateless-gui by cisco-system-traffic-generator.

the class MultiplierOption method buildUI.

/**
 * Build multiplier view UI
 *
 * @param title
 * @param group
 */
private void buildUI(String title, ToggleGroup group) {
    // add radio button
    selection = new RadioButton(title);
    selection.setToggleGroup(group);
    selection.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
        if (newValue) {
            multiplierSelectionEvent.onMultiplierSelect(type);
        }
        value.setDisable(!newValue);
    });
    setTooltip();
    getChildren().add(selection);
    MultiplierOption.setTopAnchor(selection, 15d);
    MultiplierOption.setLeftAnchor(selection, 0d);
    // text field
    value = new TextField();
    value.setPrefSize(120, 22);
    value.setDisable(true);
    value.addEventFilter(KeyEvent.KEY_RELEASED, multiplierSelectionEvent.validateInput());
    String regex = unitRegex();
    final UnaryOperator<TextFormatter.Change> keyPressFilter = c -> {
        String text = c.getControlNewText();
        if (text.matches(regex)) {
            return c;
        } else {
            return null;
        }
    };
    value.setTextFormatter(new TextFormatter<>(keyPressFilter));
    getChildren().add(value);
    MultiplierOption.setTopAnchor(value, 43d);
    MultiplierOption.setLeftAnchor(value, 0d);
    MultiplierOption.setBottomAnchor(value, 15d);
}
Also used : TextField(javafx.scene.control.TextField) MultiplierType(com.exalttech.trex.ui.MultiplierType) Util(com.exalttech.trex.util.Util) UnaryOperator(java.util.function.UnaryOperator) KeyEvent(javafx.scene.input.KeyEvent) TextFormatter(javafx.scene.control.TextFormatter) Logger(org.apache.log4j.Logger) ToggleGroup(javafx.scene.control.ToggleGroup) AnchorPane(javafx.scene.layout.AnchorPane) RadioButton(javafx.scene.control.RadioButton) ObservableValue(javafx.beans.value.ObservableValue) MultiplierSelectionEvent(com.exalttech.trex.ui.components.events.MultiplierSelectionEvent) Tooltip(javafx.scene.control.Tooltip) ObservableValue(javafx.beans.value.ObservableValue) TextField(javafx.scene.control.TextField) RadioButton(javafx.scene.control.RadioButton)

Example 27 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(getbp("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);
    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 28 with RadioButton

use of javafx.scene.control.RadioButton in project BTW by TechnionYearlyProject.

the class HomeController method generateButtonClick.

@FXML
protected void generateButtonClick(ActionEvent event) {
    RadioButton selectedRadioButton = (RadioButton) generate_city_toggle.getSelectedToggle();
    if (selectedRadioButton == null)
        return;
    String switchTo;
    if (selectedRadioButton.equals(grid_radio)) {
        switchTo = "/fxml/generate_grid.fxml";
    } else if (selectedRadioButton.equals(free_form_radio)) {
        switchTo = "/fxml/generate_free_form.fxml";
    } else {
        return;
    }
    GenerateCityController.acceptAction = DrawMapController.AcceptAction.ChooseSimulation;
    switchScreens(event, switchTo);
}
Also used : RadioButton(javafx.scene.control.RadioButton) FXML(javafx.fxml.FXML)

Example 29 with RadioButton

use of javafx.scene.control.RadioButton in project Board-Instrumentation-Framework by intel.

the class Demo method initBack.

private Pane initBack(final FlipPanel flipPanel, final StackPane FRONT_PANEL) {
    Region backButton = new Region();
    backButton.getStyleClass().add("back-button");
    backButton.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel.flipToFront());
    ToggleGroup group = new ToggleGroup();
    final RadioButton standardGreen = new RadioButton("Green");
    standardGreen.setToggleGroup(group);
    standardGreen.setSelected(true);
    standardGreen.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.GREEN, CornerRadii.EMPTY, Insets.EMPTY))));
    final RadioButton amber = new RadioButton("Red");
    amber.setToggleGroup(group);
    amber.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY))));
    final RadioButton blueDarkBlue = new RadioButton("Blue");
    blueDarkBlue.setToggleGroup(group);
    blueDarkBlue.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY))));
    VBox componentsBack = new VBox(backButton, standardGreen, amber, blueDarkBlue);
    componentsBack.setSpacing(10);
    StackPane back = new StackPane();
    back.setPadding(new Insets(20, 20, 20, 20));
    back.getStyleClass().add("panel");
    back.getChildren().addAll(componentsBack);
    return back;
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) ToggleGroup(javafx.scene.control.ToggleGroup) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region) RadioButton(javafx.scene.control.RadioButton) VBox(javafx.scene.layout.VBox) StackPane(javafx.scene.layout.StackPane)

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