Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to add a listener to a toggle group radio buttons javafx

ToggleGroup genderGroup = new ToggleGroup();
male.setToggleGroup(genderGroup);
female.setToggleGroup(genderGroup);
genderGroup.selectedToggleProperty().addListener(
   (observable, oldToggle, newToggle) -> {
       if (newToggle == male) {
           gender = 'm';
       } else if (newToggle == female) {
           gender = 'f';
       } else {
           gender = '?';
       }
    }
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #listener #toggle #group #radio #buttons #javafx
ADD COMMENT
Topic
Name
4+5 =