I don't want to set the background color for all the cells in the jtable, just the ones I choose. How do i go about doing this?
Isn't there an easier faster way to do this?
vamsi
2010-03-03 05:50:19
unfortunately not. The renderer is what handles painting each individual table cell
objects
2010-03-03 05:54:28
theres an example and some discussion here http://www.jguru.com/faq/view.jsp?EID=53764
objects
2010-03-03 05:57:35
+2
A:
You might find the concept presented in Table Row Renderering easier to implement. Maybe keep a Set of Points (representing a cell you want to color). Or maybe even a Map of Points and Colors.
camickr
2010-03-03 06:24:53
A:
You'll need to create a custom CellRenderer and call it in your custom JTable's getCellRenderer(int col, int rol) method.
See http://self-reference.com/tech/swing.html for a good example.
vdoma
2010-03-03 19:41:32