Link to home
Start Free TrialLog in
Avatar of ta2000
ta2000

asked on

color

I want to find out the RGB values for a string value
for example i want to find the RGB values for "Azure"
or in other hand i want to find the hexvalue of that color ,no difference
How can i do that ?
Avatar of Kostas Harvatis
Kostas Harvatis
Flag of Greece image

I don't understand exactly what you want to do, but take a look at the static decode() method of the awt.Color class. Once you got the Color, you can extract the RGB values with the respective methods.

Avatar of ta2000
ta2000

ASKER

let me explain it in more details
I have a list which it contains  color names (such as blue,azure, cyan,LightSeaGreen, LemonChiffon and so on)
Now i want when i choose a color in my list i want to  view the hexvalue of that specified color.
for using decode i have to give the hexvalue of the color as argument .so i cant use it here,
thanks
Avatar of ta2000

ASKER

could someone help me .i am in a rush
Use getBlue(), getGreen() & getRed() of Color to get integer values for the given Color. Use toHexString(int i) of Interger class to get hex for that int. Depending on ur requirement, u can concat it & display or whatever...
Avatar of ta2000

ASKER

can you give a line of example coz i tried it but it didnt give the answer maybe my code was wrong
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ta2000

ASKER

hi
I was looking for all the colors not only constants
thanks
Only a few of them have 'names'.
ta2000:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.