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);
}
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);
}
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);
}
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;
}
Aggregations