1 | import java.applet.Applet; |
2 | import java.awt.*; |
3 | public class Pattern extends Applet |
4 | { public void paint( Graphics g ) |
5 | { |
6 | // The variable x represents where to draw in the x direction (to the right) |
7 | int x = 0; |
8 | // sets the background to be white and drawing color to be magenta |
9 | setBackground ( Color.white); |
10 | g.setColor( Color.magenta ); |
11 | // draw a sequence of 6 circles of size 40, evenly spaced |
12 | for ( int i = 0; i < 6; i++ ) |
13 | { x = x + 50; |
14 | // each circle has y = 20, width and height = 40 pixels |
15 | g.fillOval ( x, 20, 40, 40 ); |
16 | } } } |
17 |