Qualcuno sa dirmi perchè non vedo l'evidenziazione sulla riga?
public class MyTableCellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column){
int v=(Integer)value;
if (v==33) {
setForeground(Color.RED);
} else {
setForeground(null);
}
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
tester(); // TODO add your handling code here:
}
private void tester(){
DefaultTableModel model = new DefaultTableModel();
Vector rows=new Vector();
Vector cols=new Vector();
cols.add("Numero1");
cols.add("Numero2");
cols.add("Numero3");
cols.add("Numero4");
int k=0;
while(k<100)
{
Vector v=new Vector();
v.add(k);
v.add(k+1);
v.add(k+2);
v.add(k+3);
rows.add(v);
k+=4;
}
model=new DefaultTableModel(rows,cols);
jTableTest.setModel(model);
// jTableTest = new JTable(model);
jTableTest.setDefaultRenderer(Object.class, new MyTableCellRenderer());
}
Grazie anticipatamente a chiunque voglia aiutarmi