home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 22 / AMUG_22-1.ISO / Files / Internet / Java / spinalink-3.sit / spindem3 / SpinDemo3.class (.txt) < prev   
Encoding:
Java Class File  |  1997-08-22  |  5.3 KB  |  232 lines  |  [Clss/CWIE]

  1. import java.awt.Canvas;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.awt.Image;
  9. import java.awt.Polygon;
  10. import java.awt.image.ImageObserver;
  11.  
  12. class SpinDemo3 extends Canvas implements Runnable {
  13.    String label;
  14.    private boolean isdisplay;
  15.    // $FF: renamed from: ji java.lang.Thread
  16.    private Thread field_0;
  17.    private SpinDemo1 dad;
  18.    private int waitval;
  19.    private int arc_count;
  20.    private boolean setonce;
  21.    private boolean cycle;
  22.    private boolean nnmj = true;
  23.    private boolean mouse_is_down;
  24.    String gogo = "nothing selected";
  25.    Color UsersChoice;
  26.    // $FF: renamed from: gg java.awt.Font
  27.    Font field_1;
  28.    Color linkColor;
  29.    private Image ghy;
  30.    private Dimension ghjb;
  31.    private Graphics ghyb;
  32.  
  33.    public boolean mouseEnter(Event evt, int x, int y) {
  34.       if (this.mouse_is_down) {
  35.          this.set_nnmj(false);
  36.       }
  37.  
  38.       return true;
  39.    }
  40.  
  41.    public void stop() {
  42.       if (this.field_0 != null) {
  43.          this.field_0.stop();
  44.          this.field_0 = null;
  45.       }
  46.  
  47.    }
  48.  
  49.    public void hyhyxx(String ntext) {
  50.       this.gogo = ntext;
  51.       ((Component)this).repaint();
  52.    }
  53.  
  54.    public boolean mouseExit(Event evt, int x, int y) {
  55.       if (this.mouse_is_down) {
  56.          this.set_nnmj(true);
  57.       }
  58.  
  59.       return true;
  60.    }
  61.  
  62.    public void zxzx(Graphics g, boolean butup) {
  63.       int offset;
  64.       if (butup) {
  65.          offset = 0;
  66.       } else {
  67.          offset = 1;
  68.       }
  69.  
  70.       int xmid = ((Component)this).size().width / 2 - 1;
  71.       int ymid = ((Component)this).size().height / 2 - 1;
  72.       g.setColor(Color.black);
  73.       g.drawArc(xmid - 18 + offset, ymid - 18 + offset, 36, 36, 0, 360);
  74.       g.setColor(Color.gray);
  75.       g.drawArc(xmid - 19 + offset, ymid - 19 + offset, 38, 38, 50, 180);
  76.       g.setColor(Color.white);
  77.       g.drawArc(xmid - 19 + offset, ymid - 19 + offset, 38, 38, 240, 165);
  78.       if (butup) {
  79.          g.setColor(Color.green);
  80.       } else {
  81.          g.setColor(Color.red);
  82.       }
  83.  
  84.       g.drawArc(xmid - 18 + offset, ymid - 18 + offset, 36, 36, -this.arc_count, 200);
  85.       Polygon oli = new Polygon();
  86.       oli.addPoint(xmid - 9 + offset, ymid - 13 + offset);
  87.       oli.addPoint(xmid + 14 + offset, ymid + offset);
  88.       oli.addPoint(xmid - 9 + offset, ymid + 13 + offset);
  89.       oli.addPoint(xmid - 2 + offset, ymid + offset);
  90.       g.fillPolygon(oli);
  91.    }
  92.  
  93.    public void paint(Graphics g) {
  94.       g.setFont(this.field_1);
  95.       if (this.isdisplay) {
  96.          g.setColor(Color.black);
  97.          g.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  98.          g.setColor(this.linkColor);
  99.          g.drawString(this.gogo, 5, 14);
  100.       } else {
  101.          this.dad.activatebrother();
  102.          g.setColor(Color.lightGray);
  103.          g.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
  104.          g.setColor(Color.lightGray);
  105.          if (this.nnmj) {
  106.             this.paintUp(g);
  107.          } else {
  108.             this.paintUp(g);
  109.             this.bhytx(g);
  110.          }
  111.  
  112.          this.zxzx(g, this.nnmj);
  113.       }
  114.    }
  115.  
  116.    public void bhytx(Graphics g) {
  117.       g.setColor(Color.lightGray);
  118.       g.fillRect(6, 6, ((Component)this).size().width - 13, ((Component)this).size().height - 13);
  119.       g.setColor(Color.gray);
  120.       g.drawLine(6, 6, ((Component)this).size().width - 8, 6);
  121.       g.drawLine(6, 6, 6, ((Component)this).size().height - 8);
  122.    }
  123.  
  124.    public boolean mouseUp(Event evt, int x, int y) {
  125.       this.set_nnmj(true);
  126.       if (this.mouse_is_down) {
  127.          this.Xxxx();
  128.       }
  129.  
  130.       this.mouse_is_down = false;
  131.       return true;
  132.    }
  133.  
  134.    public void set_nnmj(boolean state) {
  135.       if (this.nnmj != state) {
  136.          this.nnmj = state;
  137.          ((Component)this).repaint();
  138.       }
  139.  
  140.    }
  141.  
  142.    public void Xxxx() {
  143.       this.dad.Xx();
  144.    }
  145.  
  146.    public final synchronized void update(Graphics g) {
  147.       Dimension d = ((Component)this).size();
  148.       if (this.ghy == null || d.width != this.ghjb.width || d.height != this.ghjb.height) {
  149.          this.ghy = ((Component)this).createImage(d.width, d.height);
  150.          this.ghjb = d;
  151.          this.ghyb = this.ghy.getGraphics();
  152.       }
  153.  
  154.       this.paint(this.ghyb);
  155.       g.drawImage(this.ghy, 0, 0, (ImageObserver)null);
  156.    }
  157.  
  158.    public void setUserval(Color UserCol) {
  159.       this.UsersChoice = Color.black;
  160.    }
  161.  
  162.    public void paintUp(Graphics g) {
  163.       g.setColor(Color.lightGray);
  164.       if (this.dad.bn != null) {
  165.          g.drawImage(this.dad.bn, 0, 0, this);
  166.       }
  167.  
  168.       g.draw3DRect(0, 0, ((Component)this).size().width - 1, ((Component)this).size().height - 1, true);
  169.       g.setColor(Color.lightGray);
  170.       g.fill3DRect(4, 4, ((Component)this).size().width - 9, ((Component)this).size().height - 9, false);
  171.       g.fill3DRect(6, 6, ((Component)this).size().width - 13, ((Component)this).size().height - 13, true);
  172.       g.setColor(Color.black);
  173.       g.drawRect(5, 5, ((Component)this).size().width - 12, ((Component)this).size().height - 12);
  174.    }
  175.  
  176.    public SpinDemo3(SpinDemo1 mum, boolean disp, Font dd, Color lincol) {
  177.       this.UsersChoice = Color.red;
  178.       this.field_1 = new Font("TimesRoman", 0, 14);
  179.       this.linkColor = lincol;
  180.       if (disp) {
  181.          this.isdisplay = true;
  182.          this.field_1 = dd;
  183.       }
  184.  
  185.       this.dad = mum;
  186.       ((Component)this).resize(55, 55);
  187.       this.start();
  188.       this.waitval = 100;
  189.    }
  190.  
  191.    public void start() {
  192.       if (this.field_0 == null) {
  193.          this.field_0 = new Thread(this);
  194.          this.field_0.start();
  195.       }
  196.  
  197.    }
  198.  
  199.    public boolean mouseDown(Event evt, int x, int y) {
  200.       this.set_nnmj(false);
  201.       this.mouse_is_down = true;
  202.       return true;
  203.    }
  204.  
  205.    public void run() {
  206.       while(true) {
  207.          try {
  208.             this.arc_count += 10;
  209.             if (this.arc_count >= 360) {
  210.                this.arc_count = 0;
  211.             }
  212.  
  213.             if (this.cycle) {
  214.                this.cycle = false;
  215.             } else if (!this.cycle) {
  216.                this.cycle = true;
  217.             }
  218.  
  219.             ((Component)this).repaint();
  220.             Thread.sleep((long)this.waitval);
  221.          } catch (InterruptedException var3) {
  222.             this.stop();
  223.          }
  224.       }
  225.    }
  226.  
  227.    public void setLabel(String label) {
  228.       this.label = label;
  229.       ((Component)this).repaint();
  230.    }
  231. }
  232.