import java.awt.*;
public class Circle
{
private int number;
private int diameter;
private Color colour;
public Circle(int num)
{
number = num;
diameter = randomInt(20, 50);
colour = new Color(randomInt(0, 255),randomInt(0, 255),randomInt(0, 255));
}
public int getDiameter()
{
return diameter;
}
private int randomInt(int min, int max)
{
return (int)(Math.random() * (max - min + 1) + min);
}
public void display(Graphics g, int x, int y)
{
int radius = diameter / 2;
//THE POLYGON IS SET IN ONE PLACE
int[] polyx = {6, 59, 84, 126, 151, 194, 194, 6};
int[] polyy = {47, 47, 27, 27, 47, 47, 77, 77};
g.setColor(colour);
g.fillPolygon(polyx, polyy, 8);
//THE CIRCLES ARE DRAWN IN RANDOM PLACES
g.setColor(colour);
g.fillOval(x, y, diameter, diameter);
g.setColor(Color.BLACK);
g.drawOval(x, y, diameter, diameter);
g.drawString("" + number, x + radius, y + radius);
}
}
{
}