// important sample code to generate random numbers
// study.... uses random numbers for position, color of the 500 ovals
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Application1
{
public Application1()
{
Frame df = new Frame("application frame");
df.setSize(800,500);
df.show();
int n1,n2,n3,n4,n5;
for (int i=1;i<=500;i++)
{
Graphics g = df.getGraphics();
n1=1+(int)
(Math.random()*254);
n2=1+(int)
(Math.random()*254);
n3=1+(int)
(Math.random()*254);
n4=1+(int)
(Math.random()*200);
n5=1+(int)
(Math.random()*200);
Color one = new Color(n1,n2,n3);
g.setColor(one);
g.fillOval(n4,n5,35,25);
}
}
public static void
main(String args[])
{
Application1 app = new
Application1();
System.exit(0);
}
} |