Bonjour,
Le but est de redessiner un panel lorsque des parametres changent.
Pour cela je faite un "wait" juste avant l'appel a repaint() et un notifyAll() lorsque les parmetres ont changés...
Voila mon code :
et voila les erreurs obtenues :
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 public class ControleurDAffichage extends Thread { private FenetrePrincipale f ; /** * */ public ControleurDAffichage() { this.f = new FenetrePrincipale () ; this.f.setSize(400, 350) ; this.f.setVisible(true) ; } public void run() { while (true) { try { wait() ; } catch (InterruptedException e) { System.err.println (e) ; } System.out.println("toto") ; f.getPanelImage().repaint() ; } } }
Exception in thread "main" java.lang.IllegalMonitorStateException: current thread not owner
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:474)
at controleur.ControleurDAffichage.run(ControleurDAffichage.java:38)
at controleur.ControleurPrincipal.<init>(ControleurPrincipal.java:23)
at supercalto.Main.main(Main.java:29)
Merci
++floanne.
Partager