I used a for loop to create multiple checkboxes based on the contents of another ArrayList. now I am trying to make it so when the checkboxes are clicked it will change the attributes of a certain object in an another arraylist. However, when I create the checkboxes in the for loop they all have the same name, so I dont know how to reference each one individually. I also created an ArrayList of Checkboxes thinking I could use this somehow.
for(int i =0;i<studentlist1.size();i++)
{
JCheckBox chbx = new JCheckBox(studentlist1.get(i).getName());
panel.add(chbx);
boxes.add(chbx);
}
Aucun commentaire:
Enregistrer un commentaire