The problem you see is over here :-
int lim = 9;
public static Circle[] cArray;
static Random generator = new Random();
static int left = generator.nextInt(99)+1;
static int top = generator.nextInt(99)+50;
static int radius = generator.nextInt(50)+1;
public Collection() {
for (int count = 0; count <= 9; count++) {
cArray[count] = new Circle(left,top,radius);
}
}
Instead of generating the random values for every object of Circle you create, you are actually just getting the random values once and then assigning the same value to all your Circle objects.
You will need to move the code where you generate the random values to inside the for loop so that a new value is generated for every circle object.
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
Offline 1,316 posts
since Jul 2007