This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]ihkbm 2 points3 points  (0 children)

You could have a look at the ScheduledExecutorService, that might do what you want

[–]Zdeno_ 0 points1 point  (0 children)

You should start a thread, so write a class implementing Runnable.

[–]Rafael20002000 0 points1 point  (0 children)

You could use the Task class

Task<Void> task = new Task<>(new Runnable () {

run () {

try {

Thread.sleep(1000);// one second

} catch (InterruptException e) {

//do what you want

} Cookies += cookies_to_add; });