#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    1
    Rep Power
    0

    How to change row colour of JTable?


    What I have is a JTable of paths of files. If such a file doesn't exist then that row needs to be highlighted. I've searched around for an hour or so and get the general idea that I need to create my own custom TableCellRenderer. I know that it takes 'rows' and 'columns' as parameters but I don't know how to make use of them to access individual rows and change their colours.

    Thanks.
  2. #2
  3. Daniel Schildsky
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2004
    Location
    KL, Malaysia.
    Posts
    1,555
    Rep Power
    1621

    Changing row colour


    Google is your friend. There are lots of references online about highlighting a row and changing its colour and so on..
    Here is one of the articles:
    JTable row highlighting and Decorator design pattern
    When the programming world turns decent, the real world will turn upside down.

IMN logo majestic logo threadwatch logo seochat tools logo