vendredi 29 mai 2015

Multi threading with Swing progress bar

I am running out of ideas how to make my progress bar responsive during performing RMI connection, so I have decided to ask You for help.

Here's the code :

Thread performLogin = new Thread(new Runnable()
{

    @Override
    public void run()
    {
        LoginResult = TryLogin();
    }
});

performLogin.start();
WaiterFrame.setVisible(true);
SetProgressDialog();

try
{
    performLogin.join();
}
catch(InterruptedException exc)
{
    System.err.println(exc.getLocalizedMessage());
}

if (LoginResult)
{ ... }


WaiterFrame.setVisible(false);
this.dispose();

Progress bar is unresponsive - does not animate as it should while performing performLogin thread. I was trying to run progress bar frame on the other thread too, but result was the same (as well as using Eventqueue.invokelater()).

Aucun commentaire:

Enregistrer un commentaire