list widget with different colors for each list item?
RichFOct 8 2010 — edited Oct 15 2010I'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