title: Changing JTable cell color
body: <p>This is driving me absolutely insane.</p>
  
  <p>I know that, to change the formatting of table cells with JTable, I have to use my own renderer. But I cannot seem to implement this properly.</p>
  
  <p>This is my current setup:</p>
  
  <pre><code>public class MyClass
  {
      public static void main(String args[])
      {
          JTable myTable = new JTable(10, 10);
          myTable.setDefaultRenderer ([I dont know what to put here], new CustomRenderer());
      }
  }
  
  class CustomRenderer extends DefaultTableCellRenderer 
  {
      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
      {
          Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  
          // Formatting
          return c;
      }
  }
  </code></pre>
  
  <p>What do I need to use for the first parameter of <code>setDefaultRenderer</code>? The API just says 'class'. I have no idea what to put there.</p>
  
  <p>Could someone just explain, in the simplest of terms, how I go about implementing this? Please provide an example of how I can change the formatting from within the <code>main()</code> method as well.</p>