0

JAVAFX SLEEPING ?

HI, All i want to know is 'is there a way to stop/pause the code for x amount of seconds in JavaFX ?'

11th Mar 2017, 8:54 PM
Jackthehack21
Jackthehack21 - avatar
4 Antworten
+ 2
why should you want to put your gui to sleep?
23rd Mar 2017, 1:04 PM
T0nd3
+ 1
Dont use Thread.sleep in the gui thread . Just create a separated thread to do that , then when you want to update your gui call Platform.runLater and put the required code to update inside it , something like : Runnable task=()->{ //Your code here to do non gui stuff //then update the Gui Platform.runLater(()->{ //Update gui here } ); }; //then run the thread new Thread(task).start
8th Jun 2020, 1:23 PM
Geor Martin
Geor Martin - avatar
0
please help me by getting a anwser and a small code snippet thx
11th Mar 2017, 8:54 PM
Jackthehack21
Jackthehack21 - avatar
0
Use Thread.sleep(long milliseconds); Don't forget to wrap it in a try block.
15th Jan 2018, 1:16 PM
Gamer