import java.awt.*; public class Piston extends java.applet.Applet implements Runnable{ Image pvtpics[] = new Image[14]; Image currentimg; Thread runner; int xpos = 125; int ypos=50; int i=0; MediaTracker tracker; Font f=new Font("TimesRoman",Font.BOLD,36); public void init() { String pvtsrc[] = {"tut4f1.gif", "tut4f2.gif", "tut4f3.gif", "tut4f4.gif", "tut4f5.gif", "tut4f6.gif", "tut4f7.gif", "tut4f8.gif", "tut4f9.gif", "tut4f10.gif", "tut4f11.gif", "tut4f12.gif", "tut4f13.gif", "tut4f14.gif"}; tracker=new MediaTracker(this); for (int i=0; i13) i=13; currentimg=pvtpics[i];} if(bname.equals("remove heat")){ i=i-1; if(i<0) i=0; currentimg=pvtpics[i];} repaint(); } public void paint(Graphics g) { if (tracker.checkID(0)) /*if (currentimg != null)*/ { g.drawImage(currentimg, xpos, ypos, this); } else{ g.setFont(f); g.setColor(Color.red); g.drawString("Loading images",125,80); } } }