aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes retrieving event dispatch thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "retrieving event dispatch thread" Watch "retrieving event dispatch thread" New topic
Author

retrieving event dispatch thread

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Hi Java Ranchers!

I have two threads. The first one compute some tasks and after that it call Event Dispatch Thread to present that task. Event Dispatch Thread do it, but the computations thread do another computations and Event Dispatch Thread is too slow to present the data.



I want to wait for the Event Dispatch Thread and then perform some computation. There is join() function, but how can I get a referece to the Event Dispatch Thread?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2203
    
    7
Use a Swing Worker.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

You definitely do not want to join on the EDT; it won't stop when your Runnable is finished.

If you can't use SwingWorker you can try EventQueue.invokeAndWait. This blocks until your Runnable has ended (and therefore cannot be run from the EDT itself or it's a 100% guaranteed deadlock).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: retrieving event dispatch thread