I am wondering if I can set the specified row and column color without defining my own custom TableCellRender.
Currently I am using this code
TableCellRenderer cellRenderer = this.devicePropertyTable.getCellRenderer(1, 1);
Component cellRenderComponent = cellRenderer.getTableCellRendererComponent(this.devicePropertyTable, "", false, false, 1, 1);
if (propertyValue.equalsIgnoreCase("true"))
{
cellRenderComponent.setBackground(Color.green);
}
else
{
cellRenderComponent.setBackground(Color.red);
}
I would assume that this would get the cell render-er for the table node 1,1 and color it with the respective color. But what happens is it will color the whole table.
Is there another way to do this without creating a custom TableCellRender?