This is the checkerboard, and here is the code ... import java.awt.*; import java.awt.event.*; public class checkerboard extends java.applet.Applet{ int row; int col; public void paint( Graphics g ){ g.setColor(Color.black); g.fillRect(0,0,500,500); g.setColor(Color.red); for(row=0;row<=3;row++){ for(col=0;col<=3;col++){ g.fillRect(col*100,row*100,50,50); g.fillRect(col*100+50, row*100+50, 50,50); } } } }