home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 22 / AMUG_22-1.ISO / Files / Internet / Java / ActiveMap 1.0 Demo.sit / ActiveMap / classes / ActiveMapLink.class (.txt) < prev   
Encoding:
Java Class File  |  1997-02-21  |  3.1 KB  |  147 lines  |  [????/????]

  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Image;
  4. import java.net.URL;
  5.  
  6. class ActiveMapLink {
  7.    private ActiveMap applet;
  8.    private Image highlighted;
  9.    private Image selected;
  10.    // $FF: renamed from: x int
  11.    private int field_0;
  12.    // $FF: renamed from: y int
  13.    private int field_1;
  14.    private int width;
  15.    private int height;
  16.    private URL url;
  17.    private String frame;
  18.    private String status = "";
  19.    private int textx;
  20.    private int texty;
  21.    private String text = "";
  22.    private Color textcolor;
  23.    private int imagex;
  24.    private int imagey;
  25.    private Image image1;
  26.    private boolean active;
  27.    // $FF: renamed from: on boolean
  28.    private boolean field_2;
  29.  
  30.    public ActiveMapLink(ActiveMap var1, int var2, int var3, int var4, int var5) {
  31.       this.textcolor = Color.black;
  32.       this.active = false;
  33.       this.field_2 = false;
  34.       this.applet = var1;
  35.       this.field_0 = var2;
  36.       this.field_1 = var3;
  37.       this.width = var4;
  38.       this.height = var5;
  39.    }
  40.  
  41.    public void SetImages(Image var1, Image var2) {
  42.       this.highlighted = var1;
  43.       this.selected = var2;
  44.    }
  45.  
  46.    public void SetInfo(URL var1, String var2, String var3) {
  47.       this.url = var1;
  48.       this.frame = var2;
  49.       if (this.frame.equals("-")) {
  50.          this.frame = null;
  51.       }
  52.  
  53.       this.status = var3;
  54.       if (this.status.equals("-")) {
  55.          this.status = null;
  56.       }
  57.  
  58.       if (this.status == null) {
  59.          this.status = this.url != null ? this.url.toString() : "";
  60.       }
  61.  
  62.    }
  63.  
  64.    public void SetText(int var1, int var2, String var3, Color var4) {
  65.       this.textx = var1;
  66.       this.texty = var2;
  67.       this.text = var3;
  68.       this.textcolor = var4;
  69.       if (this.text == null) {
  70.          this.text = "";
  71.       }
  72.  
  73.    }
  74.  
  75.    public void SetImage(int var1, int var2, Image var3) {
  76.       this.imagex = var1;
  77.       this.imagey = var2;
  78.       this.image1 = var3;
  79.    }
  80.  
  81.    public void SetOn() {
  82.       this.field_2 = true;
  83.    }
  84.  
  85.    public void Draw(Graphics var1) {
  86.       if (this.field_2 && this.selected != null) {
  87.          var1.drawImage(this.selected, this.field_0, this.field_1, this.applet);
  88.       } else if (this.active && this.highlighted != null) {
  89.          var1.drawImage(this.highlighted, this.field_0, this.field_1, this.applet);
  90.       }
  91.  
  92.       if (this.active) {
  93.          var1.setColor(this.textcolor);
  94.          var1.drawString(this.text, this.textx, this.texty);
  95.       }
  96.  
  97.       if (this.active && this.image1 != null) {
  98.          var1.drawImage(this.image1, this.imagex, this.imagey, this.applet);
  99.       }
  100.  
  101.    }
  102.  
  103.    public void DoMouseDown() {
  104.       if (this.applet.style == this.applet.cStayon) {
  105.          this.field_2 = true;
  106.       } else if (this.applet.style == this.applet.cExclusive) {
  107.          this.field_2 = true;
  108.       } else {
  109.          this.field_2 = !this.field_2;
  110.       }
  111.  
  112.       this.applet.repaint();
  113.       if (this.field_2 && this.url != null) {
  114.          if (this.frame != null) {
  115.             this.applet.getAppletContext().showDocument(this.url, this.frame);
  116.             return;
  117.          }
  118.  
  119.          this.applet.getAppletContext().showDocument(this.url);
  120.       }
  121.  
  122.    }
  123.  
  124.    public void DoMouseUp() {
  125.       if (this.applet.style == this.applet.cExclusive) {
  126.          this.field_2 = false;
  127.       }
  128.  
  129.    }
  130.  
  131.    public void DoMouseEnter() {
  132.       this.active = true;
  133.       this.applet.showStatus(this.status);
  134.    }
  135.  
  136.    public void DoMouseExit() {
  137.       if (this.applet.style != this.applet.cStayactive) {
  138.          this.active = false;
  139.       }
  140.  
  141.    }
  142.  
  143.    public boolean MouseHit(int var1, int var2) {
  144.       return var1 >= this.field_0 && var1 <= this.field_0 + this.width && var2 >= this.field_1 && var2 <= this.field_1 + this.height;
  145.    }
  146. }
  147.