import java.applet.*;
import java.awt.*;
import java.awt.image.*;

public class main extends Applet {

	final int 			W	 			= 320,
						H 				= 240;	
	Image				img				= null,
						mis_img			= null;
	int					pixels[]		= new int[W*H];
	MediaTracker		mt				= null;
	MemoryImageSource	mis				= null;
	
	public void init()
	{
		this.setBackground(Color.WHITE);
		this.setSize(W,H);
		
		mt = new MediaTracker(this);				
		img = this.getImage(this.getCodeBase(),"image.jpg");		
		mt.addImage(img,0);
		try {
			mt.waitForAll();
		} catch (InterruptedException ie) {
			System.err.println("MediaTracker : Interrupted!");
			return;
		}
		
		PixelGrabber pg = new PixelGrabber(img, 0, 0, W, H, pixels, 0, W);
		try {
		    pg.grabPixels();
		} catch (InterruptedException e) {
		    System.err.println("PixelGrabber : Interrupted!");
		    return;
		}
		
		mis = new MemoryImageSource(W, H, pixels, 0, W);		
	    mis_img = createImage(mis);		    		
	}	
	
	public void paint (Graphics g)
	{
		g.drawImage(mis_img,0,0,this);		
	}
}
