You can implement timers in two different ways. As r035198x says use of threads is one of the solution. In UI like Swing in Java you can use Swing timer as well. But in your case the Thread.sleep is enough, no need to involve with Swing timer. Just an info to our OP.