import java.awt.Graphics;
import java.awt.Color;
import java.awt.Font;
import java.awt.*;
public class BunsenSwirl extends java.applet.Applet implements Runnable {
Font f = new Font("TimesRoman", Font.BOLD, 36);
Color floralWhite = new Color(255,250,240);
Color colors[] = new Color[50];
Thread runner;
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
runner = null;
}
public void update(Graphics s) {
paint(s);
}
public void init() {
setBackground(Color.white);
// initialize color array
float c = 0;
for (int i = 0; i < colors.length; i++) {
colors[i] = Color.getHSBColor(c, (float)1.0, (float)1.0);
c += .02;
}
}
public void run() {
//cycle through colors
setBackground(Color.white);
int i = 0;
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
setForeground(colors[i]);
repaint();
i++;
try {
Thread.sleep(200);
} catch (InterruptedException e) { }
if (i== colors.length) i =0;
}
}
public void paint(Graphics s) {
s.setFont(f);
s.drawString("DR. STEPHEN G. BUELL", 2, 40);
}
}