Bonjours,

Voila je souhaiterai pouvoir rafraichir une JTable lors de la suppression d'une ligne de celle-ci. Après maints essais infructueux, j'en suis arrivé à cette solution mais je doute qu'elle soit correcte :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
public void supprimerProduit()
	{
		// recupere la ligne selectionnee du JTable
		int ligne = pp.getJt_afficherDonnee().getSelectedRow();
 
 
		Produit p = new Produit((String)pp.getJt_afficherDonnee().getValueAt(ligne, 0),(String)pp.getJt_afficherDonnee().getValueAt(ligne, 1),(Integer)pp.getJt_afficherDonnee().getValueAt(ligne, 2),(Double)pp.getJt_afficherDonnee().getValueAt(ligne, 3));
 
		pp.getGestionnaire().supprimerProduit(p);
		pp.setVisible(false);
		PresentationProduit ppp = new PresentationProduit(pp.getGestionnaire());
                pp.setDefaultCloseOperation(0);
		/*pp.getJt_afficherDonnee().repaint();
		pp.getJt_afficherDonnee().updateUI();
		DefaultTableModel model = (DefaultTableModel)pp.getJt_afficherDonnee().getModel();
		model.fireTableDataChanged();
		pp.getJt_afficherDonnee().setModel(model);*/
	}