TableCellRenderer and colours


2006-01-30 07:27:28 PM
jbuilder12
DefaultTableCellRenderer does not seem to have correct color reporting.
Just try the following:
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column )
{
Color color;
super.getTableCellRendererComponent( table, value, isSelected,
hasFocus, row, column );
color = getForeground();
setForeground( color );
return this;
}
This will produce garbage colouring because getForground() seems to
operate incorrectly. I need to know fore- and background colours of the
default cell rendering (look-and-feel dependent). How would I obtain
this information?
Thanks!
- Vander