Results 1 to 2 of 2
- 04-29-2011, 08:49 AM #1Member
- Join Date
- Apr 2011
- Rep Power
Changing color of similar elements in two JLists
I'm making an app which contains two Jlists. The list elements are to be compared and the same elements from both lists should show in same colors. I'm done with the comparison part but the coloring part is a problem. Tried AtributedString but no results, I'll have to use cellrenderer but how to get that specific cell to be chosen to setForeground?
- 04-29-2011, 09:42 AM #2
The ListCellRenderer's getListCellRendererComponent(...) receives prameters for the value and index. You have to work with that.
To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
Don't forget to use the code tags so your code retains its formatting.
- By Frecow in forum Java 2DReplies: 0Last Post: 04-04-2011, 10:16 AM
- By nikkka in forum New To JavaReplies: 4Last Post: 03-12-2011, 06:54 AM
- By ourimaler in forum SWT / JFaceReplies: 1Last Post: 06-02-2010, 01:08 PM
- By higuchi in forum New To JavaReplies: 1Last Post: 03-19-2009, 08:29 AM
- By Lang in forum New To JavaReplies: 1Last Post: 11-04-2007, 10:51 AM