import java.awt.*; import javax.swing.*; // public class Zebra3 extends JApplet implements Runnable { ZPanel zpanel; Thread t; boolean running=false; public void init() { Image image; MediaTracker tracker; //Use this to track loading of the image String param=this.getParameter("picture"); if (param != null) { tracker=new MediaTracker(this); image = getImage(getCodeBase(), param); //Add the image to the MediaTracker so we can track // progress loading it tracker.addImage(image,0); //Wait until image is completely loaded try { tracker.waitForAll(); } catch (InterruptedException e) { } //ignore interrupts zpanel = new ZPanel(image); } else { zpanel = new ZPanel(300,300); } Container pane = getContentPane(); pane.add(zpanel); } public void start() { t = new Thread(this); running=true; t.start(); } public void stop() { running=false; } public void run() { int steps=0; while (running ) { steps++; zpanel.update(); zpanel.repaint(); showStatus(Integer.toString(steps)); try { t.sleep(30); } catch (InterruptedException e) { System.out.println(e); } t.yield(); } } }