| import java.applet.Applet; |
| import java.awt.*; |
| public class Pattern extends Applet |
| { public void paint( Graphics g ) |
| { |
| // The variable x represents where to draw in the x direction (to the right) |
| int x = 0; |
| // 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++ ) |
| { x = x + 50; |
| // each circle has y = 20, width and height = 40 pixels |
| g.fillOval ( x, 20, 40, 40 ); |
| } } } |