home *** CD-ROM | disk | FTP | other *** search
/ Java by Example / jbecd.bin / JBE-CD / NTUsers / JBECODE.ZIP / JavaByExample / chap31 / ThreadApplet2.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-03-21  |  920 b   |  27 lines

  1. import java.applet.Applet;
  2. import java.awt.Component;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5.  
  6. public class ThreadApplet2 extends Applet {
  7.    MyThread thread;
  8.    String displayStr;
  9.    Font font;
  10.  
  11.    public void start() {
  12.       this.font = new Font("TimesRoman", 0, 72);
  13.       ((Component)this).setFont(this.font);
  14.       this.displayStr = "";
  15.       this.thread = new MyThread(this);
  16.       this.thread.start();
  17.    }
  18.  
  19.    public void stop() {
  20.       this.thread.stop();
  21.    }
  22.  
  23.    public void paint(Graphics var1) {
  24.       var1.drawString(this.displayStr, 50, 150);
  25.    }
  26. }
  27.