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

[macosx] Modal JDialog moves from position in secondary monitor to primary monitor

    XMLWordPrintable

Details

    • x86
    • os_x

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.10.1 (14B25)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Mac Pro with 2 Apple monitors

      A DESCRIPTION OF THE PROBLEM :
      I first noticed this bug when I upgraded to JDK 8, but thought at first it was a NetBeans issue. It is not. All Swing applications display this behavior.

      Any modal dialog that is moved to the secondary display will jump to the same X and Y coordinates on the primary display the next time it is clicked on.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.awt.EventQueue;
      import javax.swing.JDialog;
      import javax.swing.JFrame;
      import javax.swing.JLabel;

      public class JavaApplication10
      {
        public static void main(String[] args)
        {
          EventQueue.invokeLater(() ->
          {
            JFrame mainFrame = new JFrame("Main Frame");
            mainFrame.setSize(640, 480);
            mainFrame.setVisible(true);

            JDialog dlg = new JDialog(mainFrame, "Dialog");
            dlg.getContentPane().add(new JLabel("I'm a dialog"));
            dlg.setSize(480, 320);
            dlg.setVisible(true);
          });
        }

      }


      Run the above program on a dual monitor OS X setup. Move the dialog to the second monitor. Click on the main frame window. Then click on the dialog. Notice that the dialog will jump to the main monitor.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The dialog should stay where it is on the second monitor

      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              dmarkov Dmitry Markov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: