posted 13 years ago
Put the JCheckBoxes in an array:
Now you can access the array randomly to check them. I see two ways:
1) for X number of times get a random array element, select that. This does mean that you could potentially select the same one over and over.
2) for each element, use a random value to determine whether or not it should be selected. This does mean that you could potentially select them all, or none at all.
You can solve the problem of 1) by using a List and removing from that:
Remember to re-evaluate list.size() each time, as it will change when you remove elements.