First Programming Lab - Patterns of Shapes
import java.applet.Applet;
public class Pattern extends Applet
{ public void paint( Graphics g )
// The variable x represents where to draw in the x direction (to the right)
// sets the background to be white and drawing color to be magenta
setBackground ( Color.white);
g.setColor( Color.magenta );
// draw a sequence of 6 circles of size 40, evenly spaced
for ( int i = 0; i < 6; i++ )
// each circle has y = 20, width and height = 40 pixels
g.fillOval ( x, 20, 40, 40 );