Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Techguy Sr eng.   on May 03 In Java Category.

  
Question Answered By: Randy Warren   on May 03

I had this problem too. I got my own conclusions, but I don't know if is 100%
correctly!
I'll tell you my solution, if it's wrong  in any aspect someone correct me ok?

When a event occurs, its action run  at the Event dispath thread  to avoid that
other user action interrupt the event. So you can't unlock any other thread. In
my code, I've created another thread to notify().

public void  actionPreformed(ActionEvent event)
{
Thread theNewThread = new  Thread(new Runnable() {
public void run() {
notify();
}
});
}

Try this, use the code segment that follow to debug your program and understand
better in which thread it's running:
System.out.println(Thread.currentThread().getName());

Also, try to find some documentation about the event dispath thread.

I don't really know if this solution will work, but I hope that it help you, at
least, in some aspect.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Threading Syncronization Or get search suggestion and latest updates.