home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / May / JBUILDER / JSAMPLES.Z / ToolTipPanel$Cow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-30  |  1.9 KB  |  83 lines

  1. import com.sun.java.swing.JComponent;
  2. import com.sun.java.swing.JLabel;
  3. import java.awt.Point;
  4. import java.awt.Polygon;
  5.  
  6. class ToolTipPanel$Cow extends JLabel {
  7.    // $FF: synthetic field
  8.    private final ToolTipPanel this$0;
  9.    Polygon cowgon;
  10.    boolean moo;
  11.    boolean milk;
  12.    boolean tail;
  13.  
  14.    public ToolTipPanel$Cow(ToolTipPanel var1) {
  15.       super(SwingSet.sharedInstance().loadImageIcon("images/cow.gif", "Black and white cow"));
  16.       this.this$0 = var1;
  17.       this.this$0 = var1;
  18.       this.cowgon = new Polygon();
  19.       this.moo = false;
  20.       this.milk = false;
  21.       this.tail = false;
  22.       ((JComponent)this).setAlignmentX(0.5F);
  23.       this.cowgon.addPoint(3, 20);
  24.       this.cowgon.addPoint(44, 4);
  25.       this.cowgon.addPoint(79, 15);
  26.       this.cowgon.addPoint(130, 11);
  27.       this.cowgon.addPoint(252, 5);
  28.       this.cowgon.addPoint(181, 17);
  29.       this.cowgon.addPoint(301, 45);
  30.       this.cowgon.addPoint(292, 214);
  31.       this.cowgon.addPoint(269, 209);
  32.       this.cowgon.addPoint(266, 142);
  33.       this.cowgon.addPoint(250, 161);
  34.       this.cowgon.addPoint(235, 218);
  35.       this.cowgon.addPoint(203, 206);
  36.       this.cowgon.addPoint(215, 137);
  37.       this.cowgon.addPoint(195, 142);
  38.       this.cowgon.addPoint(143, 132);
  39.       this.cowgon.addPoint(133, 189);
  40.       this.cowgon.addPoint(160, 200);
  41.       this.cowgon.addPoint(97, 196);
  42.       this.cowgon.addPoint(107, 182);
  43.       this.cowgon.addPoint(118, 185);
  44.       this.cowgon.addPoint(110, 144);
  45.       this.cowgon.addPoint(59, 77);
  46.       this.cowgon.addPoint(30, 82);
  47.       this.cowgon.addPoint(30, 35);
  48.       this.cowgon.addPoint(15, 36);
  49.    }
  50.  
  51.    public boolean contains(int var1, int var2) {
  52.       if (var1 > 30 && var1 < 60 && var2 > 60 && var2 < 85) {
  53.          if (!this.moo) {
  54.             ((JComponent)this).setToolTipText("Mooooo");
  55.             this.moo = true;
  56.             this.milk = false;
  57.             this.tail = false;
  58.          }
  59.       } else if (var1 > 150 && var1 < 230 && var2 > 90 && var2 < 145) {
  60.          if (!this.milk) {
  61.             ((JComponent)this).setToolTipText(" Got  Milk? ");
  62.             this.milk = true;
  63.             this.moo = false;
  64.             this.tail = false;
  65.          }
  66.       } else if (var1 > 280 && var1 < 300 && var2 > 20 && var2 < 175) {
  67.          if (!this.tail) {
  68.             ((JComponent)this).setToolTipText("Tail.");
  69.             this.tail = true;
  70.             this.moo = false;
  71.             this.milk = false;
  72.          }
  73.       } else if (this.moo || this.milk || this.tail) {
  74.          ((JComponent)this).setToolTipText("Cow.");
  75.          this.moo = false;
  76.          this.tail = false;
  77.          this.milk = false;
  78.       }
  79.  
  80.       return this.cowgon.contains(new Point(var1, var2));
  81.    }
  82. }
  83.