import java.applet.*; import java.awt.*; public class prodcon extends Applet { public Image fighter; public Image poof; public producer p; public consumer c1,c2,c3; boolean firstime=true; int imghght=-1; ship ship1,ship2,ship3; UpdateThread updatethrd=new UpdateThread(this); public void init() { MediaTracker tracker=new MediaTracker(this); // set background System.out.println("here"); setBackground(Color.black); // load images fighter=getImage(getCodeBase(),"imperial.gif"); poof=getImage(getCodeBase(),"stars.gif"); tracker.addImage(fighter,0); tracker.addImage(poof,1); try { tracker.waitForID(0); tracker.waitForID(1); } catch(InterruptedException e) { return; } ship1=new ship(fighter,poof,1); ship2=new ship(fighter,poof,2); ship3=new ship(fighter,poof,3); updatethre.start(); // wait till image loaded // create and start producer p=new producer(this); p.start(); // start consumer(s) c1=new consumer("one",p); c1.start(); } }