Java Applet Program to Draw Random text at Random Location in Random Color

Write a Java applet program to draw random text at random location in random color.



Source Code
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

public class RandomDrawTextApplet extends Applet implements Runnable {

	Thread t;
	Graphics g;
	public void init()
	{
		g=getGraphics();
		Font f=new Font("Comic Sans MS",Font.BOLD,20);
		g.setFont(f);
		t=new Thread(this);
		t.start();
	}
	public void run()
	{
		while(true)
		{
			int x=(int)(Math.random()*34534%500);
			int y=(int)(Math.random()*34534%500);
			int r1=(int)(Math.random()*34534%256);
			int r2=(int)(Math.random()*34534%256);
			int r3=(int)(Math.random()*34534%256);
			Color c=new Color(r1,r2,r3);
			g.setColor(c);
			g.drawString("Java",x,y);
			try
			{
				Thread.sleep(70);
			}catch(Exception ee){}
		}
	}
}
/*
 <applet height=600 width=600 code=RandomDrawTextApplet>
 </applet>
*/
Output