-
Bug
-
Resolution: Fixed
-
P4
-
4.1, bdk_1.0, 1.1, 1.1.6, 1.2.0, 1.3.0, 1.3.1
-
b28
-
generic, x86, sparc
-
generic, solaris_2.5.1, solaris_2.6, windows_95, windows_nt
Name: rk38400 Date: 05/18/98
Using the code given below, bring up the internal
message dialog. Click on the JTextField & focus is
moved there. Worse if you bring up the
JOptionPane.showMessageDialog() before dismissing
the internal dialog you are totally locked up.
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
class TestFrame extends JFrame {
TestFrame() {
getContentPane().setLayout(new FlowLayout());
JButton dlgErrBtn = new JButton("Dialog error msg");
dlgErrBtn.addActionListener(new DlgErrBtnController());
getContentPane().add(dlgErrBtn);
getContentPane().add(new JTextField("hello world"));
JButton dlgInErrBtn = new JButton("Internal Dialog error msg");
dlgInErrBtn.addActionListener(new DlgInErrBtnController());
getContentPane().add(dlgInErrBtn);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Msg.setParent(this);
}
class DlgErrBtnController extends AbstractAction {
public void actionPerformed(ActionEvent evt) {
Msg.err("Hello World\nWe have bugs\n");
}
}
class DlgInErrBtnController extends AbstractAction {
public void actionPerformed(ActionEvent evt) {
Msg.errIn("Hello World\nWe have bugs\n");
}
}
}
class Msg {
public static void err(String s) {
if (frame == null)
System.out.println(s);
else
JOptionPane.showMessageDialog(frame.getContentPane(),s,"Standard Dialog",JOptionPane.INFORMATION_MESSAGE);
}
public static void errIn(String s) {
if (frame == null)
System.out.println(s);
else
JOptionPane.showInternalMessageDialog(frame.getContentPane(),s,"Internal Message Dialog",JOptionPane.INFORMATION_MESSAGE);
}
public static void setParent(JFrame f) {
frame = f;
}
private static JFrame frame;
}
public class TestApp {
TestApp() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
frame = new TestFrame();
frame.setSize(400,300);
frame.setVisible(true);
}
public static void main(String[] argv) {
try {
new TestApp();
}
catch(Exception e) {
System.out.println(e);
e.printStackTrace();
}
}
TestFrame frame;
}
(Review ID: 30613)
======================================================================
- duplicates
-
JDK-4159234 JOptionPane's showInternal*Dialog methods should create modal dialogs
-
- Closed
-
-
JDK-4195142 Not able to create a modal dialog box from JApplet
-
- Closed
-
-
JDK-4266981 JOptionPane.showInternalMessageDialog() methods are not modal.
-
- Closed
-
-
JDK-4147961 Modal windows (or JInternalFrame) for Applets
-
- Closed
-
- relates to
-
JDK-4508191 JOptionPane.showInternalOptionDialog blocks after its enclosing JFrame is closed
-
- Closed
-
-
JDK-4403925 JOptionPane internal dialog causes applet to deadlock when page switching
-
- Closed
-
(1 relates to)