Screen does not refresh once minimised and then maximised

I have an event handler for a button. If the user selects the button a long running operation is executed from within the class that extends ActionListener. I do this by making the following call

SwingUtilities.invokeLater(class containing run method with long operation);

What I find is that if the user presses the button and whilst the backend operation is being actioned I minimise the window followed by maximising it, it redisplays but is totally grey and does not repaint until the long running operation completes.

Any pointers ?

Thanks

Justin

[588 byte] By [JUCKKYa] at [2007-10-2 2:09:03]
# 1

You have misunderstood how to use invokeLater. The Runnable you submit to invokeLater will run on the event-dispatching thread, so you should not run long tasks there. You need to do it the other way around: you start a separate thread in which you run your long task. Whenever you need to update the UI from that thread you use invokeLater to make sure the UI is updated from the event thread.

Read more about it here:

http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

happy_hippoa at 2007-7-15 19:50:16 > top of Java-index,Desktop,Core GUI APIs...
# 2
Many thanks for taking the time to reply. I will read the article you have suggested.Thanks
JUCKKYa at 2007-7-15 19:50:17 > top of Java-index,Desktop,Core GUI APIs...