Como mudar a cor da linha de uma tabela com uma condição if

0 respostas
A
aqui meu codigo

private static void atualizaTabela() throws FileNotFoundException, IOException {

int linha = 0;

DefaultTableModel tTabela = (DefaultTableModel) tabela.getModel();

tTabela.setNumRows(0);

File files = new File(“C:\ClassAlgodao);

for (File file : files.listFiles()) {
BufferedReader ler = new BufferedReader(new FileReader(file));
        String txt = null;
        txt = ler.readLine();
        String[] spli = txt.split("###");
      if (!"Entregue".equals(spli[3])){
          tTabela.addRow(new Object[]{1});
      
        
        tabela.setValueAt(spli[0], linha, 0);
        tabela.setValueAt(spli[1], linha, 1);
        tabela.setValueAt(spli[2], linha, 2);
        tabela.setValueAt(spli[3], linha, 5);
        tabela.setValueAt(spli[4], linha, 3); 
        tabela.setValueAt(spli[5], linha, 4);
      
        
        linha++;
       ler.close(); }
      ler.close();
     
        
    }

}

o spli[3] le o arquivo em txt que tenho na pasta blz.
essa variavel slpi[3] é o status do arquivo no caso quando essa variavel for Atrasado eu quero q a linha q é mostrada na tabela fique vermelha
e quando for ENTREGUE quero que fique verde é isso
se alguem me ajudar agradeço

Criado 16 de dezembro de 2011
Respostas 0
Participantes 1