private void tabelaTesteFocusLost(java.awt.event.FocusEvent evt) {
modelo = (DefaultTableModel) tabelaTeste.getModel();
try{
CellEditor ce = tabelaTeste.getCellEditor();
ce.stopCellEditing();
}
catch(NullPointerException npe){
System.out.println("Ta estourando a nullpointer do cellEditor");
}
String parametro1 = "";
String parametro2 = "";
for(int i = 0; i < modelo.getRowCount(); i ++){
for(int j = 0; j < modelo.getColumnCount(); j++){
//tabelaCopy.setValueAt(dtm.getValueAt(i, j), i, j);
try {
if(!rs.first()){
System.out.println("Não há linhas na tabela");
}
else{
rs.first();
// rs.next();
if (rs.getObject(1) == modelo.getValueAt(i, 1)) // Aqui é feita a validação pelo codigo na tabela
System.out.println("Esta linha já esta na tabela");
else if (parametro1.isEmpty())
parametro1 = (String) modelo.getValueAt(i, j);
else
parametro2 = (String) modelo.getValueAt(i, j);
}
if(!parametro1.isEmpty() && !parametro2.isEmpty()){
String add = this.addNoBanco()+parametro1+"', "+"'"+parametro2+"')";
gt.adicionaPessoa(add);
parametro1 = "";
}
}
catch (SQLException ex) {
Logger.getLogger(TesteFoco.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
if(tabelaTeste.getValueAt(modelo.getRowCount()-1, 0) != null || tabelaTeste.getValueAt(modelo.getRowCount()-1, 1) != null){
modelo.addRow(new String[]{});
}
}
Olha só gurizada ta funcionando legal o evento de perda de foco, mas na parte que é para adicionar um registro no banco ele simplesmente não faz nada. Não entendi muito bem o debug :? Vou tentar de novo, mas conto com vc’s!

flw!