greenonions79
Technical User
Hello all,
I'm kind of new to Java and having problem using actionListeners...
In the application I'm develping when a user clicks on the startButton, it fires an actionListener which which displays a countdown on screen and updates it every second. My problem is that if the user clicks on the startButton for a second time it fires another actionlistener - so that there are two countdowns displayed on screen. I would prefer it if the first countdown could be cancelled and only the new one displayed. Is there a way to do this?
This is an extract from my code
Thanks a lot
I'm kind of new to Java and having problem using actionListeners...
In the application I'm develping when a user clicks on the startButton, it fires an actionListener which which displays a countdown on screen and updates it every second. My problem is that if the user clicks on the startButton for a second time it fires another actionlistener - so that there are two countdowns displayed on screen. I would prefer it if the first countdown could be cancelled and only the new one displayed. Is there a way to do this?
This is an extract from my code
Code:
if (source == game.startButton){
Date startTime = new Date();
ActionListener timeListen = new TimeLogic(startTime);
Timer stopWatch = new Timer(1000, timeListen);