I already have a main and a component to draw. Please help me fix this method.
public class ArrayMethod
{
private int i=8;
private int j=8;
private int[][]arrayMethod = {{0,0,0,0,0,0,0,0},
{1,0,1,0,1,0,1,0},
{0,1,0,1,0,1,0,1},
{1,0,1,0,1,0,1,0},
{0,1,0,1,0,1,0,1},
{1,0,1,0,1,0,1,0},
{0,1,0,1,0,1,0,1},
{0,0,0,0,0,0,0,0}};
public ArrayMethod(int[][] arrayComponent)
{
//arrayComponent i declared as a int[8][8]
//passed from main to class component to class arrayMethod.
arrayMethod = arrayComponent;
}
public void draw(Graphics2D g2)
{
//I tried to draw with drawString but it doesn't work
//but I look up on google some people did it and they can print it out.
g2.drawString(Integer.toString(arrayMethod[i][j]),10,10);
}
}
Guys please help me with the g2.drawString I tried so hard and it never print out the whole board 8x8 (0 and 1) in the arrayMethod like i declared.