public class ColorTest extends World
{
/**
* Constructor for objects of class ColorTest.
*
*/
public ColorTest()
{
// Create a new world with 400x400 cells with a cell size of 1x1 pixels.
super(400, 400, 1);
boolean black = true;
for (int x = 0; x <8 ; x++)
{
if(black) //alternate colors at the start of each column
black = false;
else
black = true;
for (int y = 0; y < 8; y++)
{
if(black) //alternate the colors
{
ColorPatch blackSquare = new ColorPatch(0,0,0);
addObject(blackSquare, x*50 + 25, y*50 + 25);
black = false;
}
else
{
ColorPatch redSquare = new ColorPatch(255,0,0);
addObject(redSquare, x*50 + 25, y *50 + 25);
black = true;
}
}
}
}
}