import java.awt.Graphics;
import java.awt.Color;

public class MostSimpleAnimatedApplet extends java.applet.Applet
    implements Runnable {
    Thread animationThread;
    Color c;

    public void start() {
	animationThread = new Thread(this);
	animationThread.start();
	c = Color.red;
    }

    public void paint(Graphics screen) {
	if(c == Color.red) 
	    c = Color.blue;
	else
	    c = Color.red;
	screen.setColor(c);
	screen.fillOval(30,30,10,10);
    }

    public void run() {
	while(animationThread != null) {
	    repaint();
	    wait(500);
	}
    }

    private void wait(int ms) { 
	try {
	    Thread.sleep(ms);
	} catch(InterruptedException e) { }
    }	
}

