techwiz18
03-21-2005, 05:34 AM
Hello, I'm trying to make a turtle graphics program and I need help displaying a 20X20 array to a textarea (swing). This what I have so far but this only displays one zero at the top left hand corner of the text area.
public void drawArray(int array[][]){
for (int row=0; row<array.length;row++){
for (int column=0; column<array[row].length; column++)
textArea1.setText(Integer.toString(array[row][column]));
}
}
This is an example I'm trying to use from my book:
public void drawArray(int array[][]){
for (int row=0; row<array.length;row++){
for (int column=0; column<array[row].length; column++)
System.out.printf("%d ", arrray[row][column]);
System.out.println(); //starts new line of output
}
}
I'm trying to find a command simular to System.out.println(); which will allow me to use swing instead of the system output screen.
Thanks.
public void drawArray(int array[][]){
for (int row=0; row<array.length;row++){
for (int column=0; column<array[row].length; column++)
textArea1.setText(Integer.toString(array[row][column]));
}
}
This is an example I'm trying to use from my book:
public void drawArray(int array[][]){
for (int row=0; row<array.length;row++){
for (int column=0; column<array[row].length; column++)
System.out.printf("%d ", arrray[row][column]);
System.out.println(); //starts new line of output
}
}
I'm trying to find a command simular to System.out.println(); which will allow me to use swing instead of the system output screen.
Thanks.