I have a JTable that shows different information related to various dates. So the table can have 5 rows for say 05/30/2007 and then 3 rows for 04/15/2007 and then 3 rows for 03/11/2007. I want to group all rows specific to a particular date by setting the background of those rows in one color. So all 5/30/2007 rows will be blue and 04/15/2007 rows in white and 03/11/2007 rows in blue again.
How can I do this?
Joined: Jul 16, 2006
Actually I was able to do this by keeping track of the date value in my renderer, but the problem at hand is when the user starts clicking on arbitrary cells the date information kept in the renderer is no longer valid.
You probably don't want your cell renderer maintaining state. You would be better off keeping track of that kind of thing in your TableModel. The table cell rendeder can call table.getModel() [and cast the result] to access your model.