// load an array of images, loop through the array and 
// display each image

import java.applet.Applet;
import java.awt.*;

public class SlideShow extends Applet {

	private Image img[];
	private int totalImages = 3,
		    currentImage = 0,
		    sleepTime = 1000; // 1 sec = 1000 milliseconds
	
   public void init()
// load the image when the applet begins executing
     	{
		img = new Image[ totalImages ];
		for ( int count = 0; count < img.length; count++)
 		img[count] = getImage( getDocumentBase(), 
				"images/pic" + count + ".jpg");
	}

   public void start()
	{
		currentImage = 0;	// always start with the first image
	}

// display the image in the Applet's Graphics context
// then sleep and call repaint
   public void paint(Graphics g)
     {
	g.drawImage(img[currentImage], 1, 1, this);
	
	
// fix to help load images in Netscape Navigator
// make browser "think" there is a mouse event
	postEvent (new Event( this, Event.MOUSE_ENTER, "" ) );

	currentImage = ++currentImage % totalImages;

	try
		{ Thread.sleep( sleepTime ); }
	catch ( InterruptedException e )
		{ showStatus (e.toString() ); }
	
	repaint ();	
      }
 }