|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/lavish.interport/ |
Upload File : |
/* swirly colors */
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Font;
import java.awt.Component;
public class Swirl extends java.applet.Applet implements Runnable {
Font f = new Font("TimesRoman",Font.BOLD,14);
Color colors[] = new Color[50];
Thread runThread;
public void start() {
if (runThread == null) {
runThread = new Thread(this);
setBackground(Color.black);
runThread.start();
}
}
public void stop() {
if (runThread != null) {
runThread.stop();
runThread = null;
}
}
public void run() {
// initialize the color arry
float c = 0;
setBackground(Color.black);
for (int i = 0; i < colors.length; i++) {
colors[i] = Color.getHSBColor(c, (float)1.0,(float)1.0);
c += .02;
}
// cycle through the colors
int i = 0;
while (true) {
setForeground(colors[i]);
setBackground(Color.black);
repaint();
i++;
try { Thread.currentThread().sleep(50); }
catch (InterruptedException e) { }
if (i == (colors.length - 1)) i = 0;
}
}
public void update(Graphics g) {
setBackground(Color.black);
paint(g);
setBackground(Color.black);
}
public void paint(Graphics g) {
g.setFont(f);
setBackground(Color.black);
g.drawString("My Favorites : ", 2,14);
setBackground(Color.black);
}
}