Java Code

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

public class Checkerboard 
                          extends JApplet
{
    public void paint ( Graphics g )
    {
        // row 1
        g.fillRect ( 20,20, 10,10 );
        g.fillRect ( 40,20, 10,10 );
        g.fillRect ( 60,20, 10,10 );
        g.fillRect ( 80,20, 10,10 );
        g.fillRect ( 100,20, 10,10 );
        
        // row 2
        g.fillRect ( 30,30, 10,10 );
        g.fillRect ( 50,30, 10,10 );
        g.fillRect ( 70,30, 10,10 );
        g.fillRect ( 90,30, 10,10 );
        g.fillRect ( 110,30, 10,10 );
    }	
}

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