Java Code

import javax.swing.*;
import java.awt.*;

public class Checkerboard2 extends JApplet
{
    public void paint ( Graphics g )
    {
        drawRows( g, 20, 20 );
        drawRows( g, 30, 30 );
    }
    public void drawRows( Graphics graphics, int x, int y )
    {
        graphics.fillRect ( x, y, 10,10 );
        graphics.fillRect ( x+20, y, 10,10 );
        graphics.fillRect ( x+40, y, 10,10 );
        graphics.fillRect ( x+60, y, 10,10 );
        graphics.fillRect ( x+80, y, 10,10 );
    }	
}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved