import java.applet.*; import java.awt.*; import java.awt.image.*; public class main extends Applet { final int W = 320, H = 240; Image img = null; int pixels[] = new int[W*H]; MediaTracker mt = 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; } } public void paint (Graphics g) { g.drawImage(img,0,0,this); } }