For example to override the getColumnClass() method:
public Class getColumnClass(int column)
{
for (int row = 0; row < getRowCount(); row++)
{
Object o = getValueAt(row, column);
if (o != null)
{
return o.getClass();
}
}
return Object.class;
}
Then to add the renderer to the table you do:
table.setDefaultRenderer(Double.class, new NumberCellRenderer());
You might also want to check out Table Format Renderers for some generic renderers and you could use:
table.setDefaultRenderer(Double.class, new NumberRenderer( new DecimalFormat("#.00") ));