Write a program that randomly draws characters in different font, sizes and colors.(File must be save as: Assignment10v.java)
//import java.awt.Graphics;
//import java.awt.Font;
import java.awt.*;//Color;
import java.applet.Applet;
import java.util.Random;
public class Assignment10v extends Applet
{
public void paint(Graphics g)
{
String st="ICE";
int x,y,z,i,size;
Color c;
Font f;
Random r= new Random();
for (i=0; i<200; i+=20)
{
x=r.nextInt(256);
c=new Color(x,(x+150)%256,(x+90)%256);
x=x%40+11;
f=new Font("Arial",0,x);
g.setColor(c);
g.setFont(f);
g.drawString(st,0,i);
}
}
}
////////////////////////////////////////////
Copy & paste this code in your Textpad & run, then you will get output.......
If you have any problem please comment below.........
Copy & paste this code in your Textpad & run, then you will get output.......
If you have any problem please comment below.........