我明白了:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
..获取行的值:
String ENTRY = (String) table.getModel().getValueAt(row, 2)`
这是代码:
tab.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);
String ENTRY = table.getModel().getValueAt(row,2).toString();
if (!ENTRY.equals("active")) {
setBackground(Color.GREEN);
}
return this;
}
});`