Supprimer une ligne d'un tableau
Salut j'ai besoin de vous, j'ai une erreur :
java.lang.ClassCastException: javax.swing.JTable$1 cannot be cast to MotDePasse.TableauXML
J'ai posté sur le forum de ce site mais comme personne ne me répond, je m'adresse à vous. Voici mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
private int row;
private JTable table;
public void setRow(int row){this.row = row;}
public void setTable(JTable table){this.table = table;}
public void actionPerformed(ActionEvent event) {
JOptionPane jop = new JOptionPane();
int option = jop.showConfirmDialog(null, "Voulez-vous supprimer les informations ?", "Effacer les données", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
if(option == JOptionPane.OK_OPTION)
{
if(table.getRowCount() > 0){
((TableauXML) table.getModel()).removeRow(this.row);
}
}
} |
l'erreur vient sur la ligne 15 ((TableauXML) table.getModel()).removeRow(this.row);
Pouvez vous m'aider svp