0

Possible Duplicate:
Changing JTable cell color

I have to set the color of some specific cells in jtable but when i write the following code the whole table is colored

Component cell=(Component) jTable2.getCellRenderer(0,0);
                cell.setBackground(Color.BLUE);

In this case only (0,0) should be colored.

Community
  • 1
  • 1
harry4
  • 189
  • 1
  • 4
  • 16
  • @GuillaumePolet did not get you. – harry4 Oct 14 '12 at 08:58
  • 1
    how about doing at least a _bit_ of research on the topic? Starting with the Swing tutorial referenced in the swing tag wiki, particularly [How to use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender) and going on with the references to earlier related questions, listed in the sidebar? – kleopatra Oct 14 '12 at 09:52
  • You've basically grabbed the default renderer for all the cells and changed the color that it should use to render all the cells. Check out the like Guilluame provided for more information – MadProgrammer Oct 14 '12 at 10:10

0 Answers0