M
McGowan
Hi, I am trying to loop through 81 text boxes each time reading the
text from the box and placing it in a 2d array.
My code below shows it doing just the first line so only 9 text boxes
private void jButton1_actionPerformed(ActionEvent e) {
int userAnswer [][] = new int [9][9];
for (int i = 0; i < 9; i++) {
try {
userAnswer [0] = Integer.valueOf(A1.getText());
} catch (NumberFormatException nf) {
userAnswer[0] = 0;
}
System.out.println(i + " " + userAnswer[0]);
}
}
Where it says A1 I want it to change automatically to A2, A3, A4 and
so on on each iteration of the loop increasing by 1 all the way to 9.
Any ideas?
Thanks,
OIiver
text from the box and placing it in a 2d array.
My code below shows it doing just the first line so only 9 text boxes
private void jButton1_actionPerformed(ActionEvent e) {
int userAnswer [][] = new int [9][9];
for (int i = 0; i < 9; i++) {
try {
userAnswer [0] = Integer.valueOf(A1.getText());
} catch (NumberFormatException nf) {
userAnswer[0] = 0;
}
System.out.println(i + " " + userAnswer[0]);
}
}
Where it says A1 I want it to change automatically to A2, A3, A4 and
so on on each iteration of the loop increasing by 1 all the way to 9.
Any ideas?
Thanks,
OIiver