How to get selected radio button from ToggleGroup

后端 未结 5 867
一生所求
一生所求 2020-12-09 16:24

I an working on JavaFX 8 and SceneBuilder. I created some radio buttons in the FXML File and specified a toggleGroup name to a radio button list in

5条回答
  •  庸人自扰
    2020-12-09 16:51

     @FXML
     ToggleGroup right; //I called it right in SceneBuilder.
    

    later somewhere in method.

    RadioButton selectedRadioButton = (RadioButton) right.getSelectedToggle();
    String toogleGroupValue = selectedRadioButton.getText();
    

提交回复
热议问题