Skip to Main Content

Java SE (Java Platform, Standard Edition)

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

list widget with different colors for each list item?

RichFOct 8 2010 — edited Oct 15 2010
I'm going to add a list widget to my Interactive Color Wheel:

* http://r0k.us/graphics/SIHwheel.html

It's an old applet, first published in 1998, and pre-dating Swing.

The list will contain the 1,567 color names for which it knows color values. I would like to have the background color on each item to be that of its named color. The color name foreground text will be white or black, chosen for readability upon its background. Basically, I am hoping to accomplish what the Name that Color page does with its HTML-form list widget:

* http://chir.ag/projects/name-that-color/

I've studied the java.awt.list document:

* http://download.oracle.com/javase/1.4.2/docs/api/java/awt/List.html

The setBackground() and setForeground() methods are implemented, but they appear to only apply to the List as a whole. As far as I can tell, there appears to be no access to list items themselves as components. I hope I'm just missing the obvious.

-- Rich
This post has been answered by pietblok on Oct 9 2010
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 12 2010
Added on Oct 8 2010
10 comments
4,436 views