I have 11 different checkboxes in my JFrame and want to be able to get a number whenever one is checked for how many total are checked. I know how to set up an ItemListener and see if one is checked, but I am not sure how I could check all of them..
EDIT:
cblist is an ArrayList containing 11 JCheckBoxes. I gave every JCheckBox an item listener and hereis the class used when the checkboxes are clicked...
private class CheckClass implements ItemListener{
public void itemStateChanged(ItemEvent event){
for(cblist.isChecked){
ingnum++;
}
}
}
In the for loop, how do I test all elements of the ArrayList..I understand my syntax is not correct right now.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…