call expensive code inside event handler
Posted on 2007-10-18
// some expensive code(calling someClass.someMethod()
// that someClass is already instantiated in the GUI
when actionPerformed() is called the GUI (the JDialog class from which it`s called) is hung until the expensive code is complete and then shows the appended strings. During the execution time the textArea is not scrollable. I want the textArea to show dynamically things happening in someClass.someMethod() if I pass a reference to it. But since it doesn`t show thefirst string str1 appended until the execution is complete, I guess I need to something else, may be run a seperate thread for someClass.someMethod() ?