Eu tenho uma JTable com os componentes de um banco de dados. Fiz um botão que exclui uma linha do banco de dados através de seu ID, e que também atualiza o JTable. Ele exclui a linha, mas ao invés de atualizar, tá acontecendo isso (OBS.: Não é retornado nenhuma mensagem de erro):
Antes de clicar no botão de excluir:
OBS.: Estou usando o Netbeans 8.1
OBS.: Estou utilizando o AbstractTableModel.
Código-fonte:
private void excluirActionPerformed(java.awt.event.ActionEvent evt) {
int o = Integer.parseInt(excluido.getText().trim());
String i = "delete from ESTADOS where ID = ?";
try {
PreparedStatement pst = c.conn.prepareStatement(i);
pst.setInt(1, o);
int x = pst.executeUpdate();
t.fireTableStructureChanged();
JOptionPane.showMessageDialog(null, "DEU CERTO");
} catch (SQLException ex) {
Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}
PS: A variável “t” é a minha tableModel.