import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ImageLibrary extends Frame
{
	private Image myImageList[] = new Image[11];
	private String myFileNames[] = {"tree.jpg","man01.jpg","man02.jpg","man03.jpg",
								"man04.jpg","man05.jpg","man06.jpg","man07.jpg",
								"man08.jpg","man09.jpg","man10.jpg"};		

	ImageLibrary()
	{
		//get images
		Toolkit toolkit = Toolkit.getDefaultToolkit();
		MediaTracker mediaTracker = new MediaTracker(this);
		
		for (int i = 0; i<=10 ; i++)
		{
			//myImageList[i] = toolkit.getImage(myFileNames[i]);
			myImageList[i] = toolkit.getImage(getClass().getResource(myFileNames[i]));
			mediaTracker.addImage(myImageList[i],0);
			try
			{
				mediaTracker.waitForID(0);
			}
			catch(InterruptedException ie)
			{
				System.err.println(ie);
				System.exit(1);
			}			
		}


	}
	//methods
	//return particular image
	public Image getImage(int x)
	{
		return myImageList[x];
	}
}
