// shapes.java
//
// Example using various Java drawing primitives

import java.applet.Applet;   
import java.awt.*;
public class shapes extends Applet {

	public void message (Graphics grafObj) {
		Font myFont = new Font ("TimesRoman", Font.BOLD, 24);
		grafObj.setColor (Color.blue);
		grafObj.setFont(myFont);
		grafObj.drawString("How nice!", 15, 350);
	}

	public void paint (Graphics grafObj) {
		grafObj.setColor (Color.white);
		grafObj.fillRect (0, 0, 400, 400);

		int frames = 15;
		int [] x1;
		int [] y1;
		int [] width;
		int [] height;
		x1 = new int [frames];
		y1 = new int [frames];
		width = new int [frames];
		height = new int [frames];
		int i;

		for (i = 0; i < frames; i++) {
			x1 [i] = 10 + i*10;;
			y1 [i] = 10 + i*i;
			width [i] = 180 - i*2;
			height [i] = 160 - i*2;
		}

		for (i = 0; i < frames; i++) {
			Color myColor = new Color (10*i, 0, 0);
			grafObj.setColor (myColor);
			grafObj.fillRect (x1[i], y1[i], width[i], height[i]);
			try {
				Thread.sleep (200);
			} catch (InterruptedException e) {}
		}

		grafObj.setColor (Color.green);
		grafObj.drawOval (1, 240, 150, 150);
		grafObj.fillOval (40, 280, 10, 17);
		grafObj.fillOval (100, 280, 10, 17);
		message(grafObj);
	}
}
