So Im trying to check if the total number of checkboxes selected is == 10. If so I'm wanting to disable the rest of the checkboxes that aren't selected! Meaning that a user can only select 10 checkboxes.
I was thinking a for loop
which loops through an array and then checks if a checkbox is selected and then adds 1 to the counter. If the counter reaches 10 I thought It may be easy to disable the rest of the checkboxes but obviously not!
List<Checkbox> chkSongs = new ArrayList<Checkbox>();
String labels[] = {"songA", "songB", "songC", "songD", "songE",
"songF", "songG", "songH", "songI", "songJ", "songK", "songL", "songM",
"songN", "songO", "songP", "songQ", "songR", "songS", "songT"}
for (int i = 0; i < labels.length; i++) {
Checkbox checkbox = new Checkbox(labels[i]);
chkSongs.add(checkbox);
formPanel.add(checkbox);
}