Hi i am new to java and trying to work out how to use a nudge btn on a fruit slot game i have created so far i have come up with this code:
When the nudge button is pressed I want the the timer1 to run for 5 sec and stop but this code just freezes the whole program
any help?
Thanks!
if (e.getSource()== btnnudge1 ){
timer1.start();
long start = System.currentTimeMillis();
timer1.start();
long end = start + 10*1000;
while (System.currentTimeMillis() < end);
timer1.stop();
}
When the nudge button is pressed I want the the timer1 to run for 5 sec and stop but this code just freezes the whole program
any help?
Thanks!