When using HTML in my JTable cells it will be displayed as
<html><b>Example</html></b>
and not with the proper html styles. I read that default renderers work with html text. How do i change my custom renderer to display HTML correctly ?
My Jtable:
tab_months = new JTable(tabmod_months) {
@Override public Component prepareRenderer(TableCellRenderer renderer,
int row,
int col){
Component c = super.prepareRenderer(renderer, row, col);
int selCol = tab_months.getSelectedColumn();
int selRow = tab_months.getSelectedRow();
if ( selCol != -1 && selRow != -1 ){
if (row == selRow){
c.setBackground(new Color(163,198,255));
} else {
c.setBackground(new Color(255,240,245));
}
}
if (row>=0 && row<listOpenmonths.size()+1) {
setToolTipText(listOpenmonths.get(row).getmonthsString());
}
return c;
}
};
Found the problem: my html tag was inside of the string and it wasn't recognized...changed the string format and it worked. Thank you !