Paint help
public void paint (Graphics g)
{
super.paint(g);
int width = getWidth();
int height = getHeight();
int x2 = width;
int y2 = height;
int xcoord = gridcoord;
int ycoord = gridcoord;
squareX = width/ grid;
squareY = height/grid;
for (int j=-10; j<=grid; j++) // the number of squares on the y axis
{
g.drawLine (xcoord,ycoord, x2,ycoord);
ycoord += squareY ;
}
ycoord = gridcoord;
for (int i=-12; i<=grid; i++) // the number of squares on the x axis
{
g.setColor(Color.black);
g.drawLine (xcoord,ycoord, xcoord,y2);
xcoord = xcoord + squareX;
}
g.setColor(Color.black); // colour each square to this colour
for(int row = 0; row < gridcell.length; row++)
{
for(int col = 0; col < gridcell[row].length; col++)
{
if(gridcell[row][col] == colour)
{
xcoord = gridcoord + col * squareX + 1;
ycoord = gridcoord + row * squareY + 1;
g.fillRect(xcoord, ycoord, squareX - 1, squareY - 1);
}
}
}
}
Ok, so this alll works fine. But on my actual GUI, i have a button called "Clear". This clear button is in class Frame, and this clear button should repaint the whole grid (with no cells in black). Now, i'm trying to call the paint method when the Clear button is pressed, just not sure of how to do that. I tried calling the paint component directly, that didn't help. Any ideas from you guys?

