I'm using a custom CellRenderer (an instance of TableCellRenderer) to render the Cells of CLOSE column depicted below. I have set a color for the table's setSelectionBackGround but the cells of the said column's bg color doesn't get painted when selected. please provide me with any insight for which I shall be extremely grateful.
Here is my TablecellRenderer Class
class LabelRenderer extends JLabel implements TableCellRenderer {
Font f;
Color selectionBG;
Color upDirection;
LabelRenderer(){
super();
f=new java.awt.Font("Trebuchet MS", 0, 12);
selectionBG = new java.awt.Color(204, 255, 255);
upDirection= new Color(0,102,0);
}
@Override
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
//structure of passing array (value)
// new Object[]{boolean direction, String close (change%)}
Object arr[] = (Object[])value;
Boolean direction = (Boolean)arr[0];
if( direction )
this.setForeground(upDirection);//GREEN
else
this.setForeground(Color.red);
this.setText(arr[1].toString());
this.setFont(f);
return this;
}
}