I got a serious problem with my recent project: I am doing a long comparison in a methode called writer(...) and it takes about 20 seconds. The methode is decalred in the View class, where my GUI elements are setted also. While the method is comparing, I would like to update a progressbar, but anyway I do it, it's always getting updated when the methode has done it's comparison... Any ideas?
Here's my code (okay - parts of it):
Thread t = new Thread(new Runnable()
{
public void run()
{
writer(List1, List2);
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
bar.setValue(SOME_VALUE);
}
});
}
});
The thread ist started through an ActionListener of an button with
t.start();