home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / WDESAMPL.BIN / NervousText.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-01  |  1.9 KB  |  76 lines

  1. import java.applet.Applet;
  2. import java.awt.Component;
  3. import java.awt.Event;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6.  
  7. public class NervousText extends Applet implements Runnable {
  8.    char[] separated;
  9.    // $FF: renamed from: s java.lang.String
  10.    String field_0;
  11.    Thread killme;
  12.    // $FF: renamed from: i int
  13.    int field_1;
  14.    int x_coord;
  15.    int y_coord;
  16.    String num;
  17.    int speed = 35;
  18.    int counter;
  19.    boolean threadSuspended = false;
  20.  
  21.    public void init() {
  22.       this.field_0 = ((Applet)this).getParameter("text");
  23.       if (this.field_0 == null) {
  24.          this.field_0 = "HotJava";
  25.       }
  26.  
  27.       this.separated = new char[this.field_0.length()];
  28.       this.field_0.getChars(0, this.field_0.length(), this.separated, 0);
  29.       ((Applet)this).resize((this.field_0.length() + 1) * 15, 50);
  30.       ((Component)this).setFont(new Font("TimesRoman", 1, 36));
  31.    }
  32.  
  33.    public void start() {
  34.       if (this.killme == null) {
  35.          this.killme = new Thread(this);
  36.          this.killme.start();
  37.       }
  38.  
  39.    }
  40.  
  41.    public void stop() {
  42.       this.killme = null;
  43.    }
  44.  
  45.    public void run() {
  46.       for(; this.killme != null; ((Component)this).repaint()) {
  47.          try {
  48.             Thread.sleep(100L);
  49.          } catch (InterruptedException var1) {
  50.          }
  51.       }
  52.  
  53.       this.killme = null;
  54.    }
  55.  
  56.    public void paint(Graphics var1) {
  57.       for(this.field_1 = 0; this.field_1 < this.field_0.length(); ++this.field_1) {
  58.          this.x_coord = (int)(Math.random() * (double)10.0F + (double)(15 * this.field_1));
  59.          this.y_coord = (int)(Math.random() * (double)10.0F + (double)36.0F);
  60.          var1.drawChars(this.separated, this.field_1, 1, this.x_coord, this.y_coord);
  61.       }
  62.  
  63.    }
  64.  
  65.    public boolean mouseDown(Event var1, int var2, int var3) {
  66.       if (this.threadSuspended) {
  67.          this.killme.resume();
  68.       } else {
  69.          this.killme.suspend();
  70.       }
  71.  
  72.       this.threadSuspended = !this.threadSuspended;
  73.       return true;
  74.    }
  75. }
  76.