Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4266981

JOptionPane.showInternalMessageDialog() methods are not modal.

    XMLWordPrintable

    Details

      Description

      JOptionPane.showMessageDialog() methods are modal. Whereas,
      JOptionPane.showInternalMessageDialog() methods are not.
      However, the doc for JOptionPane class clearly stated that
      "All dialogs are modal".

      The following program demonstrates the problem of internal
      message dialog not been modal.

      Since jdk1.3 has the problem with internal message not displaying
      (see bug #4256578), please use jdk1.2 to verify this
      behavior.

      ------------------------------------------------------------------------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class test extends JFrame {
          JButton b1 = new JButton("show internal message dialog");
          JButton b2 = new JButton("show external message dialog");

          public test() {
      Container contentPane = getContentPane();
      contentPane.setLayout(new FlowLayout());
      contentPane.add(b1);
      contentPane.add(b2);

      b1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      JOptionPane.showInternalMessageDialog(
      b1,
      "Hello World! this is an internal message dialog",
      "Internal, Am I a Modal Dialog?",
      JOptionPane.PLAIN_MESSAGE);
      }
      });

      b2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      JOptionPane.showMessageDialog(
      b2,
      "Hello World! this is external message dialog",
      "External, Am I a Modal Dialog?",
      JOptionPane.INFORMATION_MESSAGE);
      }
      });

      addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent we) {
                      System.exit(0);
                  }
              });

      setSize(500, 500);
      show();
          }
          static void main(String[] argv) {
      test t = new test();
         }
      }
      ------------------------------------------------------------------------

      Roger Pham 8/30/99

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amfowler Anne Fowler (Inactive)
              Reporter:
              rphamsunw Roger Pham (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: