Home arrow static arrow Java Programming [Archive] - Forcing Messages to be processed
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Forcing Messages to be processed
This topic has 3 replies on 1 page.

Posts:25
Registered: 5/23/02
Forcing Messages to be processed  
Jul 19, 2004 1:24 PM



 
Hi Everybody,

:. I need to process all pending messages before doing some task. Is there a way to process every message in the Event queue? Is there a flushMessages method or alike?

Regards.

kilsw5
 

Posts:2,399
Registered: 10/26/00
Re: Forcing Messages to be processed  
Jul 19, 2004 2:06 PM (reply 1 of 3)



 
If you are referring to the java.awt.EventQueue, then use invokeLater.

If this doesn't answer your question, you could provide more details, like which queue you are talking about and why you need this behavior.
 

Posts:25
Registered: 5/23/02
Re: Forcing Messages to be processed  
Jul 19, 2004 2:18 PM (reply 2 of 3)



 
:. I bought a Java component that communicate to serial devices. The problem is that that component use Sleep method to wait for their answers, causing the whole GUI to freeze. No way to modify the component itself, so I was thinking to force repainting the whole app before calling any method of that component. I just want a simple synchronization, a way of flushing the AWT event queue. That would solve most of the problem.

Regards.

kilsw5
 

Posts:2,399
Registered: 10/26/00
Re: Forcing Messages to be processed  
Jul 19, 2004 3:21 PM (reply 3 of 3)



 
invoke the calls to the serial device component on a separate thread. When the invocation returns (its not sleeping anymore) then update the gui state.
 
This topic has 3 replies on 1 page.