Hello all,
I have a thread that I use a loop and i put the sleep method into it to incriment the process to where I need it:
Here is the problem, during the incriment of sleep, a user can click a button and I need to be able to stop the process instantly.
So my question is, is there another way to put in an "x" second delay through the process but also be able to do checks in between the pause so that it can kick out when someone clicks a certain button??
I thought about a while loop but how would i be able to keep it at exactly x seconds between each cycle?
Thanks for any ideas
Bob
I have a thread that I use a loop and i put the sleep method into it to incriment the process to where I need it:
while(MODE == 3 && !GAMELIST.isEmpty() && sv.getKeepGoing()) { try{ SPENTBALLS.add(GAMELIST.get(0)); sv.broadcast("SPENTBALLS", MODE, SPENTBALLS.toString()); GAMELIST.remove(0); Thread.sleep(SBB * 1000); } catch(Exception e) { System.out.println(e); } }
Here is the problem, during the incriment of sleep, a user can click a button and I need to be able to stop the process instantly.
So my question is, is there another way to put in an "x" second delay through the process but also be able to do checks in between the pause so that it can kick out when someone clicks a certain button??
I thought about a while loop but how would i be able to keep it at exactly x seconds between each cycle?
Thanks for any ideas
Bob