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

[macosx] Frame warps to lower left of screen when displayed

    Details

    • Subcomponent:
    • Resolved In Build:
      b68
    • CPU:
      x86
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        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 :
        MacOS 10.9.5, 10.10

        A DESCRIPTION OF THE PROBLEM :
        I have found that displaying a frame can cause the frame to warp to the lower left corner of the screen, similar to the effect reported in bug 8032595 (which is reportedly fixed in this release). Two conditions appear to be necessary: Before making the frame visible, the frame is first packed, then resized with a height close to or greater than the available screen height.


        REGRESSION. Last worked in version 7u45

        ADDITIONAL REGRESSION INFORMATION:
        Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
        Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        The following test program illustrates.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The frame should be visible and (nearly) fill the screen.
        ACTUAL -
        The top of the frame is near the bottom of the screen, so that the frame is mostly not visible.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package test;

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

        public class Main
        {
            public Main()
            {
                int offset = 10; // the bug happens when offset is <= 10
                GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
                Rectangle gb = gc.getBounds();
                Insets s = Toolkit.getDefaultToolkit().getScreenInsets(gc);
                Rectangle r = new Rectangle(gb.x + s.left, gb.y + s.top, gb.width - s.left - s.right, gb.height - s.top - s.bottom - offset);
                final JFrame w = new JFrame();
                w.pack(); // necessary to show the bug
                w.setBounds(r);
                w.setVisible(true);
            }

            public static void main(String[] args)
            {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        new Main();
                    }
                });
            }
        }

        // not affected by dock position or hiding
        // not affected by screen menu bar
        // happens in JDK 8u25, not in JDK 7

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

        CUSTOMER SUBMITTED WORKAROUND :
        Don't pack or don't make the frame too tall.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  alexsch Alexander Scherbatiy (Inactive)
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: