How to use this Color's constructor? Java

Posted by MaxMackie on Stack Overflow See other posts from Stack Overflow or by MaxMackie
Published on 2011-05-26T18:06:28Z Indexed on 2012/06/05 22:40 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

According to Oracle's site, the class Color has a constructor that accepts a single int value which represents an RGB value. http://download.oracle.com/javase/1.4.2/docs/api/java/awt/Color.html#Color(int)

An RGB color is actually three different numbers ranging from 0-255. So combining them together to make one int would look like this:

White 255,255,255
White 255255255 

Right? So I pass this to the constructor and get a vibrant teal color. What am I doing wrong? What haven't I understood?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing