I'm creating a defined amount of objects from another class, and attempting to randomize the color for each one using java.awt.Color.
for (int i = 0; i < numBalls; i++){
ballsInSim.add(
new BoxBall(
0,
0,
(int) boxWidth,
(int) boxHeight,
rng.nextInt(35) + 15,
rng.nextInt(500) + 25,
rng.nextInt(500) + 25,
Color.BLUE, // Create new Colour here using constructor
myCanvas
)
);
}
Where Color.BLUE
currently is, I'd like to call one of Color's constructors that uses three integers for the red, green, and blue values (Color(int r, int g, int b)).
How do I call that constructor? I am relatively new to Java and I'm having some trouble wrapping my head around this.