0
How to use timer in java swing?
i want to develop puzzle game using java swing. for that i want to add timer for that. i use lot of techniquesm. but it won't work in netbeans. so anyone know,please give me a correct solution
1 Answer
0
You need a CountDownTimer. Make a new object of the CountDownTimer. It takes 2 arguments, millisInFuture and countDownInterval, and has two methods that you can override, onTick() and onFinish(). You can use millisUntilFinished argument of the onTick() method to display the remaining time. The timer can be started be calling the start method and it can be stopped using the cancel method.