Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ToggleGroup with ToggleButtons JavaFX

Tags:

javafx

How do I deselect all ToggleButtons in a ToggleGroup in JavaFX? There doesn't seem to be a clearSelection() feature like there was in Swing.

like image 580
goodcow Avatar asked May 04 '14 23:05

goodcow


1 Answers

You can either do

toggleGroup.selectToggle(null);

or, if you know something is selected,

toggleGroup.getSelectedToggle().setSelected(false);
like image 100
James_D Avatar answered Oct 24 '22 09:10

James_D