Estou com um problema aqui. Ao excluir uma linha selecionada da tabela, aparece a seguinte exception:
“Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer.”
Porém o cast que ela me mostrar já está sendo feito na linha que ela corrige:
“
a.setRmAluno((Integer)jTable1.getValueAt(jTable1.getSelectedRow(), 0));”
Segue o código do botão:
if (jTable1.getSelectedRow() != -1) {
DadosAluno a = new DadosAluno();
Aluno aDAO = new Aluno();
a.setRmAluno((Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0));
// a.setRmAluno((int) jTable1.getValueAt(jTable1.getSelectedRow(), 0));
aDAO.delete(a);
try {
readJTableAluno();
}catch(Exception e){
e.printStackTrace();
}
} else {
JOptionPane.showMessageDialog(null, "Selecione um aluno para excluir!");
}