I work on Java FX.
I have a tableview in which I created a "select checkbox" column. The goal is when a user clicks on a checkbox, an alert message appears.
To test it, I first tried to display a System.out.println message.
The problem are :
- when I only select one checkbox, I have a System.out.println message that writes all the checkboxes :
com.calculatrice.app.model.Person@34752060 com.calculatrice.app.model.Person@654bd7bc com.calculatrice.app.model.Person@74bbebe0 com.calculatrice.app.model.Person@2e23be4f com.calculatrice.app.model.Person@3348edcb com.calculatrice.app.model.Person@8052a29 com.calculatrice.app.model.Person@23ca3422 com.calculatrice.app.model.Person@102837d2 com.calculatrice.app.model.Person@647ab6a9
- when I select nothing, I have the same System.out.println message
How could I do to have a message with item(s), corresponding to the checkbox(es) selected ?
Here is my snippet :
private void selectCheckBox(ActionEvent ae) {
// personTable is the Tableview ; Person is the class where the getter is declared
for(Person p : personTable.getItems()){
if (p.getSelect().isSelected()){
System.out.println (p + " is selected");
}
}
}
Aucun commentaire:
Enregistrer un commentaire