Bom dia pessoal, estou tentando implementar em minha aplicação uma forma de identificar linhas duplicadas.
Estou utilizando esse codigo para comparar a ultima linha com todas as linhas menos a ultima.
[code]if(tmPdv.getRowCount()> 1){
for (int linhas = 0; linhas < jTable1.getRowCount()-1; linhas++) //Pegue o número de linhas da tabela.
{
String ultimaLinha = (String) jTable1.getValueAt(jTable1.getRowCount(), 1) ;
String linhaAtual = (String) tmPdv.getValueAt(linhas, 1);
if(ultimaLinha.equals(linhaAtual)){
JOptionPane.showMessageDialog(null, “Esta linha já exite!”);
}
}
}[/code]
Mais está dando o seguinte erro:
Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: 2 >= 2
Alguem tem uma sugestão? Como posso resolver?