当数据在另一个数据之后时,为什么颜色不会改变。所有行都变黄了。我哪里错了?
try {
dataFattura = format.parse(tfDataFt.getText());
} catch (ParseException ex) {
Logger.getLogger(FatturaClientiScheda.class.getName()).log(Level.SEVERE, null, ex);
}
tabella.setDefaultRenderer(Object.class, new DefaultTableCellRenderer(){
@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row, int col){
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
try {
dataFormulario = format.parse((String) model.getValueAt(row, 1));
} catch (ParseException ex) {
Logger.getLogger(FatturaClientiScheda.class.getName()).log(Level.SEVERE, null, ex);
}
if (dataFormulario.after(dataFattura))
{
setBackground(Color.yellow);
}
return this;
}
});