I'm developing a small aplication with java and swing and I'm facing a problem that might make me do a part of it from scratch.
In one of the panels I have around 20 checkboxes. So far the variable names are jcheckbox1, jcheckbox2, etc. I need to iterate through all of them and retrieve the text of the selected ones. The problem comes with the fact that I have used NetBeans to develop my GUI by dragging and dropping the elements as I needed them, so I don't have my checkboxes aggregated in a list or an array. Given this, is there any possibility to select all checkboxes and iterate through them to retrive the text value of the ones checked?
If there isn't, how should I declare them in a way that I can iterate easily through them? I believe an array of checkboxes might not be very hard to do by itself, but the trouble seems to come from placing them all in the correct positions. I'm using gridbag with two columns, if that helps.
Thanks!