home *** CD-ROM | disk | FTP | other *** search
/ Java by Example / jbecd.bin / JBE-CD / NTUsers / JBECODE.ZIP / JavaByExample / chap31 / ColorThread2.java < prev    next >
Text File  |  1996-03-21  |  597b  |  34 lines

  1. import java.awt.Color;
  2.  
  3. public class ColorThread2 extends Thread
  4. {
  5.     ThreadApplet6 applet;
  6.     int count;
  7.  
  8.     ColorThread2(ThreadApplet6 applet)
  9.     {
  10.         this.applet = applet;
  11.     }
  12.  
  13.     public void run()
  14.     {
  15.         while (true)
  16.         {
  17.             applet.color1 = Color.red;
  18.             applet.color2 = Color.green;
  19.             applet.color3 = Color.blue;
  20.  
  21.             applet.repaint();
  22.  
  23.             try
  24.             {
  25.                 sleep(100);
  26.             }
  27.             catch (InterruptedException e)
  28.             {
  29.             }
  30.         }
  31.     }
  32. }
  33.  
  34.