How to add RGB values ​​to setColor () in Java?

How can I add (red, green, blue) values ​​to my Java? For instance:

 setColor(255, 0, 0);
+4
source share
1 answer

You can get an instance of Color with simple code:

Color myWhite = new Color(255, 255, 255); // Color white

Then you can set the RGB color for your object like this:

g.setColor(myWhite);

Hope this helps you!

+11
source

Source: https://habr.com/ru/post/1672547/


All Articles