• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get hold of the EventDispatchThread  RSS feed

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created a UI class (a JPanel).I have a ComboBox in this UI that shows the Name of all the available objects. When creating a new object from this Panel, it sends a message to SERVER and creats the object in DataBase. The Server replies to the above request with either SUCCESS or FAIL.
If the reply is SUCCESS then I have to update the ComboBox with the name of the new Object.

Problem: The message that I am sending to Server internally creates a timertask and sends message to server. The UI is getting updated before the response is coming back from SERVER. I have to make the EventDispatchThread to wait till it gets response from the server. How do I do this?
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use a timer? You can use a regular thread, and EventQueue.invokeAndWait or EventQueue.invokeLater.
The other thread should do something like this:
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply!! I will try it out
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!