Creating a JFrame from an applet then closing the browser window while the JFrame has focus seems to cause a deadlock.
This seems only to happens on WinXP and IE6 and 1.4.1+
Using the testcase below you can reproduce this by:
1. start Internet Explorer, open url of the page with the Applet
2. maximize the browser window
3. open 20-30 browser windows with file->new->window menu (or Ctrl+N) - they
all should be running the applet and be maximized
4. now click on the button in the applet - a new frame should open in the
upper-left corner, it should be the active window now
5. while this external frame remains active, press directly the close button
of the browser window, the X button in the top-right corner
6. repeat this procedure starting with step 4 until all browser windows are
closed
<HTML>
<HEAD>
<TITLE>Swing Applet Test</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<BODY>
<OBJECT height="100%" width="100%" classid=clsid:CAFEEFAC-0014-0001-0002-ABCDEFFEDCBA>
<PARAM NAME="code" VALUE="SwingAppletTest.class">
<COMMENT>
<APPLET type="application/x-java-applet;version=1.4.1_02" width="100%" height="100%">
<PARAM NAME="code" VALUE="SwingAppletTest.class">
</applet>
</COMMENT>
</OBJECT>
</BODY>
</HTML>
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class SwingAppletTest extends JApplet {
public void start() {
JButton button = new JButton("Press ME!");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame frame = new JFrame();
frame.getContentPane().add(new JLabel("External"));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
});
getContentPane().add(button);
}
}
|