How to restrict the number of checkboxes that a user can select? I want to make it so the user can only select 3. I think I should use isSelected, but I don't know how to link all the checkboxes.
CheckBox cb1 = new CheckBox("Pepperoni");
CheckBox cb2 = new CheckBox("Cheese");
CheckBox cb3 = new CheckBox("Tomato");
CheckBox cb4 = new CheckBox("Olives");
CheckBox cb5 = new CheckBox("Chicken");
//if 3 are already selected, it should not be possible for the user to select more
Aucun commentaire:
Enregistrer un commentaire