How to add RGB values into setColor() in Java?
You can get a Color instance with the simple code:
Color myWhite = new Color(255, 255, 255); // Color white
Then, you can set RGB color to your object with something like that:
g.setColor(myWhite);
Hope it helps you!
Or you can do:
setColor(new Color(r, g, b));
For example:
setColor(new Color(0, 0, 0)); //sets the color to Black