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

[macosx] Modal dialog is shown behind non-modal dialog if invoked from frame in a full screen mode

XMLWordPrintable

      FULL PRODUCT VERSION :
      1.8.0_92, 1.7.0_55

      ADDITIONAL OS VERSION INFORMATION :
      OS X El Capitan
      10.11.4

      A DESCRIPTION OF THE PROBLEM :
      Modal dialog is shown behind non-modal dialog (parent) if owning frame is in a full screen mode

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Show a frame.
      Switch it into a full screen mode
      Open non-modal dialog
      Open another modal dialog


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Last modal dialog is on top of owning non-modal dialog
      ACTUAL -
      Last modal dialog is hidden under owning non-modal dialog

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import com.apple.eawt.FullScreenUtilities;

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

      public class TestFrame extends JFrame
      {
      public TestFrame() throws HeadlessException
      {
      super("Test Frame");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      setSize(500, 500);
      FullScreenUtilities.setWindowCanFullScreen(this, true);

      Container contentPane = getContentPane();
      contentPane.setLayout(new FlowLayout());
      contentPane.add(new JButton(new AbstractAction("Open non-modal dialog")
      {
      @Override
      public void actionPerformed(ActionEvent e)
      {
      new NonModalDialog(TestFrame.this).setVisible(true);
      }
      }));

      }

      public static void main(String args[])
      {
      new TestFrame().setVisible(true);
      }

      private static class NonModalDialog extends JDialog
      {
      public NonModalDialog(Window parent)
      {
      super(parent, "Non-modal");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      setSize(200, 200);

      Container contentPane = getContentPane();
      contentPane.setLayout(new FlowLayout());
      contentPane.add(new JButton(new AbstractAction("Open modal dialog")
      {
      @Override
      public void actionPerformed(ActionEvent e)
      {
      new ModalDialog(NonModalDialog.this).setVisible(true);
      }
      }));
      }
      }

      private static class ModalDialog extends JDialog
      {
      public ModalDialog(Window parent)
      {
      super(parent, "Modal");
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      setSize(200, 200);
      }
      }
      }

      ---------- END SOURCE ----------

            aniyogi Avik Niyogi (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: