import java.applet.*;
import java.awt.*;
import java.net.*;

public class Fuzz extends Applet implements Runnable {
	Image fuzzball;
	Thread tt;
	int eye = 50;
	boolean slidingRight = true;

	public void init(){
	     try {
		  fuzzball = getImage(new URL("http://www.mit.edu:8001/people/mkgray/fuzzball-pre.gif"));
	     } catch (Exception e) {
		  System.out.println("Uh oh..."+e);
	     }
	}
	public void start(){
	     (tt = new Thread(this)).start();
	}
	public void run(){
	     tt.setPriority(Thread.MIN_PRIORITY);
	     while(true){
		  if(slidingRight){
		       eye++;
		  }
		  else{
		       eye--;
		  }
		  if(eye > 57) {
		       slidingRight = false;
		  }
		  if(eye < 51) {
		       slidingRight = true;
		  }
		  repaint();
		  try {Thread.sleep(300);} catch (Exception e) { }
	     }
	}

	public void update(Graphics g){
	     g.clipRect(0,70,120,30);
	     paint(g);
	}

	public void stop(){
	     tt.stop();
	}
	public void paint(Graphics g){
	     g.drawImage(fuzzball, 0,0, this);
	     g.setColor(Color.black);
	     g.fillArc(eye,74,10,10,0,360);
	     g.fillArc(eye+32,74,10,10,0,360);
	}
}
