Using MediaTracker

MediaTracker:

Add the following lines before the init method: MediaTracker tracker; String id[] = {"Elko, NV", "St. Maries, ID", "Libby, MT", "Stahl Lookout, MT", "Stahl Lookout, MT", "US-Canadian Border", "St. Mary, MT", "Ptarmigan Tunnel, Glacier NP, MT" }; Add the following lines into the init method: tracker = new MediaTracker(this); curr = new Image[8]; curr[0]=getImage(getDocumentBase(),"polar.jpg"); curr[1]=getImage(getDocumentBase(),"jack.jpg"); curr[2]=getImage(getDocumentBase(),"eagle.jpg"); curr[3]=getImage(getDocumentBase(),"stahl.jpg"); curr[4]=getImage(getDocumentBase(),"gang.jpg"); curr[5]=getImage(getDocumentBase(), "border.jpg"); curr[6]=getImage(getDocumentBase(), "bear.jpg"); curr[7]=getImage(getDocumentBase(), "tunnel.jpg"); for(int i=0; i<curr.length; i++) tracker.addImage(curr[i],0); try { tracker.waitForAll(); } catch(InterruptedException e) { showStatus("Interrupted while loading images."); } showStatus("Images Loaded"); d=getSize(); addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e){ c++; c%=curr.length; showStatus(id[c]); repaint(); } }); Add the following line into the paint method: g.drawImage(curr[c],10,10,200,200,this);