Hi, I have a list of dynamically created components like Jlabel and JCheckBox in a panel as below:
Label1cbk1 cbk2 cbk3
Label2cbk1 cbk2 cbk3 cbk4 cbk5 cbk6
.
.
.
Labelncbk1 cbk2 cbk3
I am trying to add/store these sets of values into a hashmap. I store the labelName(
String) and capture
corresponding checkbox valuess(integer array) into an integer array. Then I add labelName as key and
check box values as value into hashmap. My logic works as below:
My logic is, I am checking every component. If it is a label, I am assiging it to "key"
value. As long as the next coponent of check box is not label, I am collecting it into
int array. (Basically I am scanning through every component in the panel) So if teh next element is
label, the time to add key and values into hashmap and will start scanning next line.
Inside my action Listener:
While executing, I get an exception as below:
Exception in
thread "AWT-EventQueue-0"
java.lang.ArrayIndexOutOfBoundsException: No such child: 3 Is it due to any thread problem or logic problem?