Bonjour,
J'essai de rafraîchir une JPanel en utilisant revalidate() repaint() updateUI() mais sans aucune réaction.

Voici mon code:

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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
public class HomeIHM extends JFrame{
 
	private JPanel center;
	private Image img;
 
	private static Locale DEFAULT = Locale.FRENCH;
	private static ResourceBundle dictionary;
 
	static 
	{
		dictionary = ResourceBundle.getBundle("Messages", DEFAULT);
	}
 
	public HomeIHM() {
 
	    super(dictionary.getString("homeIHM.title"));
	    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    this.setLocationRelativeTo(null);
	    img = Toolkit.getDefaultToolkit().getImage("img/logo.png");
	    this.setIconImage(img);
 
	    center = new JPanel();
	    ImageIcon icon = new ImageIcon("img/Word.png");
	    JLabel center = new JLabel(icon);
 
	    getContentPane().add(center);
 
	    pack();
	    setVisible(true);
 
	}
 
	public JPanel getCenter() {
		return center;
	}
 
	public void setCenter(JPanel center) {
		this.center = center;
	}
 
 
	public void updateLab(String  text)
	{
		center.add(new JLabel("text"));
		center.revalidate(); // aucune reaction 
	}
Aprés l'affichage de la frame, je demande la mise a jour du Label grace a "updateLab" mais toujours rien


Votre aide me serait vraiment précieuse