Simple question, but I can't seem to find the answer anywhere online.
How do you use a custom TableCellRenderer to render some of the table cells in boldface?
I know how to use TableCellRenderer to set the background color on a cell-by-cell basis. You do something like:
public class MyTableCellRenderer extends DefaultTableCellRenderer
{
@Override 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);
// modify the component "c" to have whatever attributes you like
// for this particular cell
}
}
I would assume changing the rendering text style is similar, but how do you set the font to be the same as the default table font but in boldface?