import javax.swing.JPanel;
import java.awt.Color;
import java.util.Random;
import java.awt.Graphics;
public class MyPanel extends JPanel {
private int n;
private int cr,cg,cb;
private int r;
private int x,y;
Random random = new Random();
public MyPanel() {
n = random.nextInt(6) + 5;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.BLACK);
Circle[] circle = new Circle[n];
for (int i=0; i<n; i++) {
cr = random.nextInt(256);
cg = random.nextInt(256);
cb = random.nextInt(256);
// x = random.nextInt(600);
r = random.nextInt(200)+1;
y = random.nextInt(400-2*r);
x = random.nextInt(550-2*r);
circle[i] = new Circle(x, y, r, new Color(cr,cg,cb));
}
for (int i=0; i<n; i++) {
circle[i].draw(g);
}
}
}