This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
wood burning stoves
 
subject: Help! Colors for Table Rows
 
Similar Threads
Datatable rows onMouseOut color change
Alternate colors to table rows
How to apply CSS to JSF Datatable
xml data islands + alternate row color
alternate rows in one color