Merci de ta réponse, le problème est que j'ai toujours une exception (javais mi l'autre thread pour ne plus l'avoir)
La classe ne notifie pas l'interface mais fait bien une pulsation par seconde
Exception in thread "Thread-4" java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-4
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
| public void start(){
secondes = 0;
running = true;
thread = new Thread(new Runnable() {
@Override public void run() {
while(running) {
try {
secondes++;
description = ""+secondes;
notifie();
System.out.println("pulse... " + secondes);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread.start();
} |
Partager