home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Graphics;
- import java.awt.Image;
- import java.net.MalformedURLException;
- import java.net.URL;
-
- class HrefButtonArea extends ImageMapArea {
- URL anchor;
- Image upImage;
- Image downImage;
- boolean pressed = false;
- int border = 5;
-
- public void handleArg(String var1) {
- try {
- this.anchor = new URL(super.parent.getDocumentBase(), var1);
- } catch (MalformedURLException var2) {
- this.anchor = null;
- }
-
- if (this.border * 2 > super.W || this.border * 2 > super.H) {
- this.border = Math.min(super.W, super.H) / 2;
- }
-
- }
-
- public void makeImages() {
- this.upImage = super.parent.getHighlight(super.X, super.Y, super.W, super.H, new ButtonFilter(false, super.parent.hlpercent, this.border, super.W, super.H));
- this.downImage = super.parent.getHighlight(super.X, super.Y, super.W, super.H, new ButtonFilter(true, super.parent.hlpercent, this.border, super.W, super.H));
- }
-
- public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- if (var1 == (this.pressed ? this.downImage : this.upImage)) {
- return super.parent.imageUpdate(var1, var2, var3 + super.X, var4 + super.Y, var5, var6);
- } else {
- return var1 == this.downImage || var1 == this.upImage;
- }
- }
-
- public boolean isTerminal() {
- return true;
- }
-
- public void highlight(Graphics var1) {
- if (super.entered) {
- var1.drawImage(this.pressed ? this.downImage : this.upImage, super.X, super.Y, this);
- }
-
- }
-
- public void enter() {
- ((ImageMapArea)this).showStatus(this.anchor != null ? "Go To " + this.anchor.toExternalForm() : null);
- ((ImageMapArea)this).repaint();
- }
-
- public void exit() {
- ((ImageMapArea)this).showStatus((String)null);
- ((ImageMapArea)this).repaint();
- }
-
- public boolean press() {
- this.pressed = true;
- ((ImageMapArea)this).repaint();
- return true;
- }
-
- public boolean lift(int var1, int var2) {
- this.pressed = false;
- ((ImageMapArea)this).repaint();
- if (((ImageMapArea)this).inside(var1, var2) && this.anchor != null) {
- ((ImageMapArea)this).showDocument(this.anchor);
- }
-
- return true;
- }
- }
-