home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Graphics;
- import java.awt.Image;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.StringTokenizer;
-
- class AniArea extends ImageMapArea {
- Image sourceImage;
- int nFrames;
- int[] coords;
- int currentFrame;
-
- public void handleArg(String var1) {
- StringTokenizer var2 = new StringTokenizer(var1, ", ");
- String var3 = var2.nextToken();
-
- try {
- this.sourceImage = super.parent.getImage(new URL(super.parent.getDocumentBase(), var3));
- super.parent.addImage(this.sourceImage);
- } catch (MalformedURLException var4) {
- }
-
- this.nFrames = 0;
- this.coords = new int[40];
-
- while(var2.hasMoreTokens()) {
- this.coords[this.nFrames * 2] = Integer.parseInt(var2.nextToken());
- this.coords[this.nFrames * 2 + 1] = Integer.parseInt(var2.nextToken());
- ++this.nFrames;
- if (this.nFrames > 19) {
- return;
- }
- }
-
- }
-
- public boolean animate() {
- if (super.entered) {
- ((ImageMapArea)this).repaint();
- }
-
- return super.entered;
- }
-
- public void enter() {
- this.currentFrame = 0;
- super.parent.startAnimation();
- }
-
- public void highlight(Graphics var1) {
- if (super.entered) {
- ((ImageMapArea)this).drawImage(var1, this.sourceImage, super.X - this.coords[this.currentFrame * 2], super.Y - this.coords[this.currentFrame * 2 + 1], super.X, super.Y, super.W, super.H);
- ++this.currentFrame;
- if (this.currentFrame >= this.nFrames) {
- this.currentFrame = 0;
- }
- }
-
- }
- }
-