Q:

Java - Using timer to countdown until app closure

How can I use a Timer to count down from X to zero and increment the jProgressBar I have in my form? 
The plan is, the program starts up checking if some needed files are installed, if they're not, the corresponding method tries to install them.  If that fails, the method tells the calling method so.  If these codes have been detected, the user gets notified that the program can't install the files and the program will get shut down with the notice "Please make sure you have started the program with administrative (uac) or root (sudo) rights.". 
I'd like to use a timer to count down like I would in Visual Basic. 
Any help is much appreciated. 
Thanks in advance. 

A:

Threads: http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html
If you show some code or clarify your question bit better I can offer you better help but from what I digested you want to update your jProgressBar on some time interval well easy option is to create another thread. 
Thread t = new Thread(new Runnable(){
  public void run()
  {
    // Here you can use Timer or Thread sleep 1s up to X seconds
    // and on each iteration increment your jProgressBar. 
    // TODO: Your code...

    return; // To kill the thread
  }
});

t.start();

