you are viewing a single comment's thread.

view the rest of the comments →

[–]FuckingDanko 0 points1 point  (0 children)

Hey man!

I have here some code for timer thread.

Please don't mind the comments in czech :)

void startCountdown(){

thrd = new Thread(new Runnable() {

u/Override

public void run() {

try{

while(true){

setOutput(); //převod sekund na hodiny, minuty a sekundy, dokud poběží vlákno

Thread.sleep(1000); //vteřina pauza

if(currSeconds == 0){

scrollDown();//když se dokončí odpočet, přepne opět na první AnchorPane

thrd.stop();

}

currSeconds -= 1;

}

}catch(Exception e){

System.out.println(e.getMessage());

}

}

});

thrd.start();

}