home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java by Example
/
jbecd.bin
/
JBE-CD
/
NTUsers
/
JBECODE.ZIP
/
JavaByExample
/
chap31
/
ThreadApplet5.java
< prev
next >
Wrap
Text File
|
1996-03-21
|
732b
|
39 lines
import java.awt.*;
import java.applet.*;
import ColorThread;
public class ThreadApplet5 extends Applet
{
ColorThread thread;
Color color1;
Color color2;
Color color3;
Font font;
public void start()
{
color1 = Color.red;
color2 = Color.green;
color3 = Color.blue;
thread = new ColorThread(this);
thread.start();
}
public void stop()
{
thread.stop();
}
public void paint(Graphics g)
{
g.setColor(color1);
g.fillRect(30, 50, 50, 100);
g.setColor(color2);
g.fillRect(100, 50, 50, 100);
g.setColor(color3);
g.fillRect(170, 50, 50, 100);
}
}