Name: joT67522 Date: 08/19/97
This occurs on WinNT351 built as a application.
Run the following in jdb. After the two windows open, close
them. The JVM doesn't shut down even though there is no
interesting activity happening. A check of the threads shows the
following;
threads
Group test1.main:
1. <java.awt.EventDispatcher>... AWT-EventQueue-0 cond. waiting
2. <java.lang.Thread>... AWT-Windows running
3. <sun.awt.ScreenUpdater>... Scrren Updater cond. waiting
The AWT-Windows thread should close when there are no
windows left. Either the dispose isn't sending the cleanup
message properly or AWT-Windows just isn't cleaning up. You
shouldn't have to use System.exit(0) just because you created
a window. In complex systems this would be tricky.
import java.awt.*;
import java.awt.event.*;
public class test1 extends Object
{
public static void main(String args[])
{
Frame testframe;
testframe = new Frame("Test1");
testframe.addWindowListener(new WindowEventDispatcher(testframe));
testframe.setVisible(true);
testframe = new Frame("Test2");
testframe.addWindowListener(new WindowEventDispatcher(testframe));
testframe.setVisible(true);
}
}
class WindowEventDispatcher extends WindowAdapter
{
Frame thetestframe;
WindowEventDispatcher (Frame atestframe)
{
thetestframe = atestframe;
}
public void windowClosing(WindowEvent aWindowEvent)
{
System.out.println("WindowClosing event");
thetestframe.setVisible(false);
// thetestframe.removeWindowListener(this);
thetestframe.dispose();
thetestframe = null;
}
}
company - Banker Trust Australia Limited , email - ###@###.###
======================================================================