import java.awt.*;
import java.applet.*;
public class color2 extends Applet implements Runnable{
Thread kick;
Color mycolor[][]=new Color[6][256];
int j,k,X,Y;
Font f;
String msg;
boolean pause=false,check;
public void init(){
msg=getParameter("message");
if(msg==null)
msg="error";
String font=getParameter("FONT");
if(font==null) font="TimesRoman";
String size=getParameter("SIZE");
if(size==null) size="40";
int s=Integer.valueOf(size).intValue();
String style=getParameter("STYLE");
if(style==null) style="0";
int st=Integer.valueOf(style).intValue();
if(st==0){ f=new Font(font,Font.PLAIN,s);
}else if(st==1){ f=new Font(font,Font.BOLD,s);
}else if(st==2){ f=new Font(font,Font.ITALIC,s);
}
String a=getParameter("pointX");
if(a==null) a="10";
X=Integer.valueOf(a).intValue();
String b=getParameter("pointY");
if(b==null) b="35";
Y=Integer.valueOf(b).intValue();
setBackground(Color.black);
for(int i=0;i<256;i++){
mycolor[0][i]=new Color(255,i,0);
mycolor[1][i]=new Color(255-i,255,0);
mycolor[2][i]=new Color(0,255,i);
mycolor[3][i]=new Color(0,255-i,255);
mycolor[4][i]=new Color(i,0,255);
mycolor[5][i]=new Color(255,0,255-i);
}
}
public void paint(Graphics g){
g.setFont(f);
g.setColor(mycolor[k][j]);
g.drawString(""+msg,X,Y);
}
public void update(Graphics g){
paint(g);
}
public boolean mouseDown(Event e,int x,int y){
if(pause){
kick.suspend();
pause=false;
}else{
kick.resume();
pause=true;
}
return true;
}
public void start(){
if(kick==null){
kick=(new Thread(this));
kick.start();
kick.suspend();
}
}
public void run(){
while(true){
j++;
if(k==0&&j==255){k=1;j=1;}
if(k==1&&j==255){k=2;j=1;}
if(k==2&&j==255){k=3;j=1;}
if(k==3&&j==255){k=4;j=1;}
if(k==4&&j==255){k=5;j=1;}
if(k==5&&j==255){k=0;j=1;}
repaint();
try{
Thread.sleep(1);
}catch(InterruptedException e){
}
}
}
public void stop(){
if(kick !=null){
kick.stop();
kick=null;
}
}
}