File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help! Colors for Table Rows
 
Similar Threads
alternate rows in one color
How to apply CSS to JSF Datatable
Alternate colors to table rows
xml data islands + alternate row color
Datatable rows onMouseOut color change