Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Changing color in particular row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Changing color in particular row" Watch "Changing color in particular row" New topic

Changing color in particular row

Andy Wong

Joined: Jun 13, 2002
Posts: 3
I would like to highlight (by changing color or font) in a particular row/cell (not column). How do I implement it? I have tried List Selection, but it is not the case; I just want change the appearance, not affect the users' selection. Please advise.
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
this topic was discussed many times before. Please use the search for finding something about it. I tried the keywords "Row Color".
Just a hint, you have to write your own TableCellRenderer. Mostly you can extend from DefaultTableCellRenderer. There you need to implement one function getTableCellRendererComponent.
It is sorta covered in the JavaRanch Style Guide.
subject: Changing color in particular row
Similar Threads
How to change the color of the row(JTable) when mouse move over it?
table row selection in Netscape
changing color of one row dynamically
Setting focus to a table row