home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.applet.Applet; import java.awt.Color; import java.awt.Component; import java.awt.Event; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.net.URL; public class animax extends Applet implements Runnable { int wCount; int currentImage; int wWidth; // $FF: renamed from: ms int int field_0; int wHeight; int wFrames; Image master; Thread tDelay; String sLink; String sTarget; public void init() { this.sLink = ((Applet)this).getParameter("link"); this.sTarget = ((Applet)this).getParameter("target"); Color clr = new Color(Integer.parseInt(((Applet)this).getParameter("red")), Integer.parseInt(((Applet)this).getParameter("green")), Integer.parseInt(((Applet)this).getParameter("blue"))); ((Component)this).setBackground(clr); this.currentImage = 0; this.wFrames = Integer.parseInt(((Applet)this).getParameter("frames")); if (this.wFrames == 0) { this.wFrames = 1; } int fps = Integer.parseInt(((Applet)this).getParameter("fps")); if (fps == 0) { fps = 4; } this.field_0 = 1000 / fps; } public Image GetGIF(Applet caller, String sGifName) throws Exception { MediaTracker mt = new MediaTracker(caller); Image temp = caller.getImage(caller.getDocumentBase(), sGifName); mt.addImage(temp, 0); caller.showStatus("Loading " + sGifName); try { mt.waitForID(0); } catch (InterruptedException var5) { } if (mt.isErrorID(0)) { caller.showStatus("Error loading " + sGifName); throw new Exception("Unable to load image " + sGifName); } else { return temp; } } public void start() { if (this.tDelay == null) { this.tDelay = new Thread(this); this.tDelay.start(); } } public void stop() { this.tDelay = null; } public void run() { for(; this.tDelay != null; ((Component)this).repaint()) { try { Thread.sleep((long)this.field_0); } catch (InterruptedException var1) { } ++this.currentImage; if (this.currentImage == 14) { this.currentImage = 0; } } this.tDelay = null; } public void update(Graphics g) { this.paint(g); } public boolean mouseDown(Event evt, int x, int y) { try { ((Applet)this).getAppletContext().showDocument(new URL(((Applet)this).getDocumentBase(), this.sLink), this.sTarget); return true; } catch (Exception var4) { return false; } } public void paint(Graphics g) { if (this.master == null) { g.clearRect(0, 0, 100, 100); try { this.master = this.GetGIF(this, ((Applet)this).getParameter("image")); } catch (Exception var2) { } this.wHeight = this.master.getHeight(this) / this.wFrames; this.wWidth = this.master.getWidth(this); } else { g.drawImage(this.master, 0, -this.wHeight * this.currentImage, this); } } }