I want to change the background color of particular table header. In my appliaction I have to set header color Red on the current month.
My Code is here::
jTable1.getTableHeader().
setDefaultRenderer(
new DefaultTableHeaderCellRenderer());
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, column);
JTableHeader tableHeader = table.getTableHeader();
if(column==1)
tableHeader.setBackground(Color.red);
return this;
}
this make all the header color's red. Please give me some suggestion. Thanks in advance.