I've seen my question asked several times but I never saw the answer I expected.
I've entered elements of a database in a JTable and I want to be able to delete/add elements via some JButtons.
The problem is that when I add/delete, the modification is visible in the database but not in the JTable. When I stop the programm and run it again, the JTable is updated.
What could I do to update the table immediatly after the modification of a row? I've tried to do this.table.repaint() but it didn't work. I think I'll have to do something with the tablemodel, probably with fireTableStructureChanged(); but I don't undersand well how to use it
Thank you very much for your time.
Here's part of my code in the controller class of the JTable, I don't think it will help..
public void update(Observable o, Object message) {
    Integer iMessage = (Integer) message;
    if (iMessage == Cours.CHANGEMENT_ELEVES) {
        int sizeEl = this.modele.getAllEleves().size();
        if (this.modele.getAllEleves() !=null) {
            Vector<String[]> data = this.modele.getAllEleves();
            for (int i=0; i<sizeEl; i++) {
                this.table.setValueAt(data.get(i)[0],i, 0);
                this.table.setValueAt(data.get(i)[1],i,1);
                this.table.setValueAt(data.get(i)[2],i,2);
        }
        this.table.repaint();
    }
    }
}