Originally posted by Matt Senecal:
[B]I need to dynamically create an unspecified number of JCheckBoxes, giving one a unique static value.
Because I don't know ahead of time how many JCheckBoxes I'll have to create, I thought that I could use one JCheckBox object and (in a loop as many times as necessary) give it unique settings and then adding the (hopefully) unique checkbox to the JPanel after each loop iteration.
This doesn't work.
What happens is that on screen I get checkboxes with different names, but their values and actions all correspond to the ones assigned to the last JCheckBox created. This makes sense, as all the JCheckBoxes point to the one JCheckBox object I created.
My question: Am I on the right track, or is there a better way to do this?
[/B]