import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.net.*;

public class SampleGif
extends      Applet
implements   ImageObserver
{
    Image pic = null;
    public void init() {
	URL url;
        try {
	    url = new URL("http://muq.org/~cynbe/java/classes/gifs/tutankamen.gif");
	} catch (MalformedURLException e) {
	    return;
	}
	pic = getImage(url);
    }
    public boolean imageUpdate(
	Image img,	int   infoflags,
	int   x,	int   y,
	int   width,	int   height
    ) {
	if ((infoflags & ERROR)   != 0)   return false;
	if ((infoflags & ALLBITS) != 0) {
	    paint( getGraphics() );
	    return false;
	}
	return true;
    }
    public void paint( Graphics g ) {
        if (pic != null) {
            g.drawImage(pic,0,0,this);
    }   }
}
