Search code examples
javafxtoggletogglebutton

JavaFX ToggleGroup Unset


i have some Toggle Buttons, now its needed to unset the toggle group. How can I do that?

The Problem at the moment is, that I programmend a Toggle Listener and thats the reason, why I have to unset the Toggle Group from the Toggle Button while the programm is running.

    ToggleGroup triangleGroup= new ToggleGroup();
    m_popupSwitch.setToggleGroup(triangleGroup);
 m_popupSwitch2.setToggleGroup(triangleGroup);

This is my start of the Program, i add some ToggleButtons to a ToggleGroup.

In the program i would like to destroy the connection between the ToggleGroup and some ToggleButtons

Thanks for your help :)

Greetings


Solution

  • Does

    toggleGroup.getToggles().remove(someToggleButton);
    

    do what you want?