1
Here’s the thing, I want to change the font color a specific part of my table when the user’s payment is up to date to blue. Otherwise, I want it to change to red. I want only the "situation" column to do that. That is, when I find "ok" I want to change to blue or to red when I find "Pendant".
// Esse é meu Renderer
public class pagamentoTableCellRenderer extends JLabel implements TableCellRenderer {
// lista de objeto dos usuários
private ArrayList<ModelUsuario> listaAluno;
public pagamentoTableCellRenderer(ArrayList<ModelUsuario> situacao) {
this.listaAluno = situacao;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ModelUsuario situacao = listaAluno.get(row);
if (situacao.getSituacao().equals("ok")) {
setForeground(Color.blue);
} else {
setForeground(Color.red);
}
return this;
}
}
public class ModeltabelaCarregar {
public static void main(String [] args) throws ParseException{
new viewControleDePagamento().setVisible(true);;
}
}
thanks man, I managed to solve the problem! But would have with me change the color of only one column?
– Rafael Motta