Hi,
I have an app with a main object (containing Swing GUI) and a supporting thread which calls on the handle() method of the object.
I noticed that when the handle() method is synchronized, while the thread is using the handle() method, the GUI on the main object are unresponsive. Code:
public synchronized void handle()){
//method code
}
i remove the synchronized keyword from handle(), the GUI is responsive even when the thread is using the handle() method.
An interesting thing to note is that when I used another object as a lock, the GUI becomes responsive again when the thread is using the handle() method. Code:
public void handle(){
synchronized(anotherObj){
//method code
}
}
This suggests that Swing GUI uses methods that are synchronized. Am I right? Feel free to point me to any resources - couldn't quite find what I wanted.
Thanks.