?
Solved

color

Posted on 2003-02-20
9
Medium Priority
?
196 Views
Last Modified: 2010-03-31
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 ?
0
Comment
Question by:ta2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:harvk
ID: 7991072
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.

0
 

Author Comment

by:ta2000
ID: 7991155
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
0
 

Author Comment

by:ta2000
ID: 7991347
could someone help me .i am in a rush
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:membersh
ID: 7991527
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...
0
 

Author Comment

by:ta2000
ID: 7991548
can you give a line of example coz i tried it but it didnt give the answer maybe my code was wrong
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 60 total points
ID: 7992935
You can only get the constituents of colors that have named constants. For instance, there is no 'LightSeaGreen'.

For named constants:

String r = "0x" + Integer.toHexString(Color.pink.getRed());
String g = "0x" + Integer.toHexString(Color.pink.getGreen());
String b = "0x" + Integer.toHexString(Color.pink.getBlue());
0
 

Author Comment

by:ta2000
ID: 7996337
hi
I was looking for all the colors not only constants
thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 7996756
Only a few of them have 'names'.
0
 

Expert Comment

by:CleanupPing
ID: 9059183
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question