Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert String to Color object

807591May 10 2008 — edited May 10 2008
Hi, I was wondering if there is a way to convert a string into a color object.
JTextArea text;
String blue = "blue";

Color col = Color.getColor(blue);

text.setBackground(col);
I found that example online but the Color object col returns a null value. Any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2008
Added on May 10 2008
4 comments
1,678 views