How do I trigger an event in the AWT thread from another thread in JDK1.1?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dan_stahlke
Posted On:   Tuesday, January 14, 2003 07:20 PM

I have a java applet that must make a network connection and receive some data. As was recommended in the Java docs, I moved the slow process of making the network connection into another thread. When the data is received, I would like to trigger an event in the AWT thread. Newer versions of java include an invokeLater method to do this, but I need something that will work on most web browsers (JDK1.1). I tried using the Component.dispatchEvent method, but this doesn't seem to execute the event action in the AWT thread.

Re: How do I trigger an event in the AWT thread from another thread in JDK1.1?

Posted By:   dan_stahlke  
Posted On:   Wednesday, February 26, 2003 07:41 PM

I finally found a solution that works for my purpose. The network connection thread triggers an event in AWT by calling a component's update() method. This works for me because redrawing the screen happened to be the event that I needed. I still don't know how to call an arbitrary function in the AWT thread from another thread.
About | Sitemap | Contact