-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0, 1.2.2
-
generic, x86
-
generic, windows_nt
We have a snippet of code that uses JOptionPane. When run using appletviewer,
the JOptionPane is modal - you have to select OK or Cancel on the JOptionPane
before the original window can get focus. On Internet Explorer and Netscape,
these come up in a separate frame and are not modal. You can go back to the
original window and type in it. Is this a bug in the browsers or in swing? Any
workarounds available?
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class ModalButton extends JApplet {
public void init() {
JPanel panel = new JPanel();
/************************************/
/* Create a listener for the button */
/************************************/
JButton displayButton = new JButton("Hit me!");
displayButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// Display importing from a file dialog box
// new SoftwareImportDialog();
String inputValue = JOptionPane.showInputDialog("Please input a value ");
}
});
panel.add(displayButton);
panel.add(new JTextField("edit me"));
getContentPane().add(panel);
}
}
<HTML>
<HEAD>
<TITLE>Modal experiment
</HEAD>
<BODY>
<APPLET CODE="ModalButton.class" WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>
Name: krT82822 Date: 07/02/99
This is a problem running under IE or Netscape parent frame using the jre plug-in mode. Running under applet viewer, a call to JOptionPane.showExxDialog results in a model dialog (ie. cannot interact with underlying components, frame, etc.), but under the Plug-in under IE or Netscape, you can still interact with the underlying components, panel, etc. How can these and dialogs in general, behave truely modal when running under the plug-in under native browsers? Sorry if this is a repeat problem report.
(Review ID: 85152)
======================================================================
the JOptionPane is modal - you have to select OK or Cancel on the JOptionPane
before the original window can get focus. On Internet Explorer and Netscape,
these come up in a separate frame and are not modal. You can go back to the
original window and type in it. Is this a bug in the browsers or in swing? Any
workarounds available?
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class ModalButton extends JApplet {
public void init() {
JPanel panel = new JPanel();
/************************************/
/* Create a listener for the button */
/************************************/
JButton displayButton = new JButton("Hit me!");
displayButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// Display importing from a file dialog box
// new SoftwareImportDialog();
String inputValue = JOptionPane.showInputDialog("Please input a value ");
}
});
panel.add(displayButton);
panel.add(new JTextField("edit me"));
getContentPane().add(panel);
}
}
<HTML>
<HEAD>
<TITLE>Modal experiment
</HEAD>
<BODY>
<APPLET CODE="ModalButton.class" WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>
Name: krT82822 Date: 07/02/99
This is a problem running under IE or Netscape parent frame using the jre plug-in mode. Running under applet viewer, a call to JOptionPane.showExxDialog results in a model dialog (ie. cannot interact with underlying components, frame, etc.), but under the Plug-in under IE or Netscape, you can still interact with the underlying components, panel, etc. How can these and dialogs in general, behave truely modal when running under the plug-in under native browsers? Sorry if this is a repeat problem report.
(Review ID: 85152)
======================================================================
- duplicates
-
JDK-4061116 Modal Dialog created by an applet does not have the correct behavior
-
- Resolved
-