wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Help! Colors for Table Rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help! Colors for Table Rows" Watch "Help! Colors for Table Rows" New topic
Author

Help! Colors for Table Rows

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
i was trying to set different Colors for different rows in a table, but in vain, it was easy to do this for column.
any information or piece of code that would help!
Thanx
-----
Imed
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
You need to create your own DefaultTableCellRenderer. In the
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
method check the row and set the background color.
Jeff Chang
Greenhorn

Joined: Aug 23, 2001
Posts: 23
Check out the examples at
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help! Colors for Table Rows