Por favor, alguém consegue me ajudar a colocar cor nas linhas de uma tabela, como neste exemplo abaixo:

Segue meu código para preencher minha tabela
private void preencherTabela()
{
// pegar o cabeçalho
JTableHeader Theader = tbServicos.getTableHeader();
// altera tamanho fonte cabeçalho
Theader.setFont(new Font("Tahoma", Font.BOLD, 14));
tbServicos.getColumn("Código").setCellRenderer(alinharCentro);
tbServicos.getColumn("Valor").setCellRenderer(alinharCentro);
listaServico = ctrser.recuperaDadosTabela(txtDescricao.getText().toUpperCase());
DefaultTableModel modelo = (DefaultTableModel) tbServicos.getModel();
modelo.setNumRows(0);
//CARREGA OS DADOS DA LISTA NA TABELA
int cont = listaServico.size();
for (int i = 0; i < cont; i++)
{
modelo.addRow(new Object[]
{
listaServico.get(i).getCodigo(),
listaServico.get(i).getDescricao(),
listaServico.get(i).getValor()
});
tbServicos.setGridColor(Color.BLACK);
}
}
Tem um exemplo que fiz há alguns anos nesta página, no exemplo eu utilizo verde e amarelo para fazer o “zebrado” da JTable.
Classe utilizada para realizar o processo de pintar as linhas.
public class PintarLinhaJtable extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component result = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (row % 2 == 0) {
result.setFont(new Font("tahoma", Font.PLAIN, 11));
result.setForeground(Color.black);
result.setBackground(Color.lightGray);
} else {
result.setFont(new Font("tahoma", Font.PLAIN, 11));
result.setForeground(Color.black);
result.setBackground(Color.white);
}
if (isSelected) {
result.setFont(new Font("tahoma", Font.PLAIN, 11));
result.setForeground(Color.black);
result.setBackground(new Color(12, 115, 245));
}
return result;
}
Chamada da classe para realizar o processo de pintar as linhas.
public void pintarJtable(JTable tabela) {
PintarLinhaJtable renderer = new PintarLinhaJtable(); //-------- Pinta linhas
for (int c = 0; c < tabela.getColumnCount(); c++) {
tabela.setDefaultRenderer(tabela.getColumnClass(c), renderer);
}
}