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 ?'
4 Respuestas
+ 2
why should you want to put your gui to sleep?
+ 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
0
please help me by getting a anwser and a small code snippet thx
0
Use Thread.sleep(long milliseconds);
Don't forget to wrap it in a try block.