FileDocCategorySizeDatePackage
movingcirc1q.javaAPI DocExample1655Thu Jul 13 00:07:14 BST 2000None

movingcirc1q

public class movingcirc1q extends Applet

Fields Summary
private int
xCoord
private int
yCoord
private int
width
private int
depth
private int
colorCounter
private int
count
private int
timer
private long
x
private long
y
Constructors Summary
Methods Summary
public java.awt.ColorgetmyColor(int colorCount)

		Color newColor;
		
		newColor = Color.black;
		switch(colorCount)
		{
			case 0: newColor = Color.black; break;
			case 1: newColor = Color.red; break;
			case 2: newColor = Color.blue; break;
			case 3: newColor = Color.yellow; break;
			case 4: newColor = Color.cyan; break;
			case 5: newColor = Color.magenta; break;
			case 6: newColor = Color.green; break;
			case 7: newColor = Color.gray; break;
			case 8: newColor = Color.white; break;
			case 9: newColor = Color.lightGray; break;
			case 10: newColor = Color.orange; break;
			case 11: newColor = Color.pink; break;
		}
		return(newColor);
	
public voidinit()


	   
	
	
public voidpaint(java.awt.Graphics g)

		Color newColor;

		x = 300;
		y = 300;
		for (count = 0; count < 12;count++)
		{
			for (timer = 0; timer < 300000; timer++)
			{
				x += y - y;
			}
			newColor = getmyColor(colorCounter);
			g.setColor(newColor);	
			g.fillRect(xCoord, yCoord, width, depth);
			g.drawString("Hello World", xCoord, yCoord + depth + 20);
			xCoord = xCoord + 15;
			yCoord = yCoord + 15;
			width = width + 10;
			depth = depth + 10;
			colorCounter = (colorCounter + 1) % 12;
		}