Results 1 to 2 of 2
  1. #1
    saisa is offline Member
    Join Date
    Apr 2011
    Rep Power

    Default 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?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    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.


Similar Threads

  1. Changing Image color
    By Frecow in forum Java 2D
    Replies: 0
    Last Post: 04-04-2011, 10:16 AM
  2. Changing background color
    By nikkka in forum New To Java
    Replies: 4
    Last Post: 03-12-2011, 05:54 AM
  3. Changing text color in SWT
    By ourimaler in forum SWT / JFace
    Replies: 1
    Last Post: 06-02-2010, 01:08 PM
  4. Color-changing model
    By higuchi in forum New To Java
    Replies: 1
    Last Post: 03-19-2009, 07:29 AM
  5. Changing the color of text
    By Lang in forum New To Java
    Replies: 1
    Last Post: 11-04-2007, 09:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts