Name: yyT116575 Date: 01/11/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Make the content pane of a JApplet a JDesktopPane. Next show a JOptionPane
internal message on the desktop pane. If the user page switches to another
applet or reloads the existing applet while the JOptionPane is showing the
message the applet and browser both hang. If the user clears the dialog first
and then page switches, no problem occurs. I have attached a sample applet
below that you can use to duplicate the problem.
I wonder if somehow the event queue created to show the option pane isn't still
getting the events for the new applet. Does the plug-in reinitialize the VM on
page switches or does it continue to use the existing event thread?
package com.workbrain.swingtest;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class TestApplet extends JApplet {
boolean isStandalone = false;
/**Get a parameter value*/
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
/**Construct the applet*/
public TestApplet() {
}
/**Initialize the applet*/
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
JDesktopPane content=new JDesktopPane();
this.setContentPane(content);
this.setSize(new Dimension(400,300));
content.setSize(new Dimension(400,300));
JMenuBar menuBar=new JMenuBar();
JMenu file=new JMenu("File");
JMenuItem show=new JMenuItem("Show");
show.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showInternalMessageDialog(TestApplet.this.getContentPane(),"This is a test");
System.out.println("Hello");
}
});
menuBar.add(file);
file.add(show);
this.setJMenuBar(menuBar);
}
/**Get Applet information*/
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo() {
return null;
}
//static initializer for setting look & feel
static {
try {
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel
(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch(Exception e) {
}
}
}
(Review ID: 114722)
======================================================================
- relates to
-
JDK-4139692 JOptionPane.showInternalMessageDialog() does not create a modal dialog
-
- Resolved
-
-
JDK-4404107 JOptionPane.showInternal*Dialog() throws AppletSecurityException
-
- Closed
-
-
JDK-4508191 JOptionPane.showInternalOptionDialog blocks after its enclosing JFrame is closed
-
- Closed
-