Click to See Complete Forum and Search --> : Thread Situation


lone_wolf_1985
May 12th, 2000, 05:11 PM
I'm using the JDK 1.0.2 to create applets that all browsers can run. What I need to do is open a dialog box and have the current thread wait until the dialog box closes. The dialog box requires input before it closes.

My real problem is that the current thread happens to be the AWT event handler thread. So if I try any wait()ing or notify()ing or suspend()ing, then it will lock up the thread and there will be no way of receiving any input.

Simply put, how can I do this without affecting the AWT thread?

Thanks.

mjpell
May 19th, 2000, 01:53 PM
You need to implement a "Worker" thread. See this tutorial

http://web2.java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

It's more about the newer versions of Swing, but the concept will be the same for you.

Basically, you need a separate thread to control your application. This will free up the AWT thread to continue painting and handling input.

Good luck!

lone_wolf_1985
May 24th, 2000, 02:41 PM
Thank you very much!