appletSize = this.getSize(); // get the dimensions of this applet
xCoord = 0; // start in the top left corner
yCoord = 0;
g.setColor(Color.red);
do
{
g.drawRect(xCoord, yCoord, width, height);
xCoord = xCoord + width;
} while (xCoord < appletSize.width);