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

Modal JOptionPane.showMessageDialog moves to the back of the parent.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: el35337 Date: 06/09/98


      modal JDialog box , created by
      JOptionPane.showMessageDialog with "new Frame()"
      argument instead of parent frame reference,
      moves to the back behind the main application
      frame, when you click on the application on
      the task bar on the bootom of the screen of
      Windows95/NT. Because box is modal, you can not
      move application frame or closed it.
      It's dead lock.


      import com.sun.java.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      final class JDialogProblem
      {
        final static String s1 =
          "Click your mouse here =============>.";
        final static String s2 =
         "You see, you can't do anything. To get it back, overlap it by any windows appl. and minimize it back";
        
        public static void main( String[] args ) {
          JFrame frame = new JFrame("Do following!") {
            public Dimension getPreferredSize() {
              return new Dimension(600,600);
            }
          };
          final JLabel label = new JLabel(s1);
          frame.getContentPane().add(BorderLayout.CENTER,label);
          frame.addMouseListener( new MouseAdapter(){
            public void mouseClicked(MouseEvent e){
      label.setText(s2);
      JOptionPane.showMessageDialog(new Frame(),
      "Select this application on task bar on the bottom of the screen.",
      "Do following!",
      JOptionPane.INFORMATION_MESSAGE);
      label.setText(s1);
            }
          });
          frame.addWindowListener( new WindowAdapter(){
            public void windowClosing(WindowEvent e){
              System.exit(0);
            }
          });
          frame.pack();
          frame.setVisible(true);
          frame.setLocation(200,100);
        }
      }
      (Review ID: 33320)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: