Java Code Examples for javafx.scene.control.RadioButton#setDisable()

The following examples show how to use javafx.scene.control.RadioButton#setDisable() . 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: RadioButtons.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
public RadioButtons() {
    super(400,100);
    ToggleGroup tg = new ToggleGroup();
    VBox vbox = new VBox();
    vbox.setSpacing(5);
    RadioButton rb1 = new RadioButton("Hello");
    rb1.setToggleGroup(tg);

    RadioButton rb2 = new RadioButton("Bye");
    rb2.setToggleGroup(tg);
    rb2.setSelected(true);

    RadioButton rb3 = new RadioButton("Disabled");
    rb3.setToggleGroup(tg);
    rb3.setSelected(false);
    rb3.setDisable(true);

    vbox.getChildren().add(rb1);
    vbox.getChildren().add(rb2);
    vbox.getChildren().add(rb3);
    getChildren().add(vbox);
}
 
Example 2
Source File: RadioButtons.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public RadioButtons() {
    super(400,100);
    ToggleGroup tg = new ToggleGroup();
    VBox vbox = new VBox();
    vbox.setSpacing(5);
    RadioButton rb1 = new RadioButton("Hello");
    rb1.setToggleGroup(tg);

    RadioButton rb2 = new RadioButton("Bye");
    rb2.setToggleGroup(tg);
    rb2.setSelected(true);

    RadioButton rb3 = new RadioButton("Disabled");
    rb3.setToggleGroup(tg);
    rb3.setSelected(false);
    rb3.setDisable(true);

    vbox.getChildren().add(rb1);
    vbox.getChildren().add(rb2);
    vbox.getChildren().add(rb3);
    getChildren().add(vbox);
}
 
Example 3
Source File: GuiFactory.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
public RadioButton getRadioButton(String text, HBox hbox, ToggleGroup group)
{
  RadioButton button = new RadioButton(text);
  hbox.getChildren().add(button);
  button.setToggleGroup(group);
  button.setDisable(true);
  return button;
}
 
Example 4
Source File: GuiFactory.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
public RadioButton getRadioButton(String text, VBox vbox, ToggleGroup group)
{
  RadioButton button = new RadioButton(text);
  vbox.getChildren().add(button);
  button.setToggleGroup(group);
  button.setDisable(true);
  return button;
}
 
Example 5
Source File: FailureNoteVBoxer.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
private ToolBar createButtonBar(boolean selectable, boolean editable) {
    ToolBar toolBar = new ToolBar();
    label = new Label(item.getLabel());
    ToggleGroup toggleGroup = new ToggleGroup();
    success = new RadioButton("Success");
    fail = new RadioButton("Fail");
    notes = new RadioButton("Notes");
    success.setDisable(!editable);
    fail.setDisable(!editable);
    notes.setDisable(!editable);
    success.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (success.isSelected()) {
            item.setSelected(1);
        }
        textArea.setDisable(success.isSelected());
    });
    fail.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (fail.isSelected()) {
            item.setSelected(3);
        }
        textArea.setDisable(success.isSelected());
    });
    notes.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (notes.isSelected()) {
            item.setSelected(2);
        }
        textArea.setDisable(success.isSelected());
    });
    int selected = item.getSelected();
    if (selected == 1) {
        success.setSelected(true);
    } else if (selected == 3) {
        fail.setSelected(true);
    } else if (selected == 2) {
        notes.setSelected(true);
    } else {
        success.setSelected(editable);
    }
    toggleGroup.getToggles().addAll(success, fail, notes);
    Region region = new Region();
    HBox.setHgrow(region, Priority.ALWAYS);
    toolBar.getItems().addAll(label, region, success, fail, notes);
    return toolBar;
}