lundi 7 mai 2018

How to trigger a JavaFX event when all ListView CheckBoxes are checked?

How can i trigger an event when all JFXCheckBoxes are checked and when all unchecked ?

This is my code:

@FXML
private JFXListView li_se;

@FXML
private void Services(ActionEvent e) {
        li_se.getItems().clear();
        for (int i = 0; i < R.OffrirService().size(); i++) {
            JFXCheckBox s = new JFXCheckBox(R.OffrirService().get(i));
            s.selectedProperty().addListener((obs, wasOn, isNowOn) -> {
                if (wasOn == false) {
                   //when checked do something
                } else {
                   //when unchecked do something
                }
                //System.out.println(s.getText() + " changed on state from " + wasOn + " to " + isNowOn);
            });
            li_se.getItems().add(s);
 }

}




Aucun commentaire:

Enregistrer un commentaire