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

[macosx] Issue with setExtendedState of JFrame

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b18, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin Storm 12.6.0 Darwin Kernel Version 12.6.0: Wed Mar 18 16:23:48 PDT 2015; root:xnu-2050.48.19~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      setExtendedState(MAXIMIZED_BOTH) on a JFrame is no longer executed immediately. There is even an animation visible when restoring a JFrame to the maximized state. Even if the JFrame is not yet displayable.

       This gives problems when restoring the position/size of a JFrame.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
      Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test application that opens a JFrame.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The window is immediately visible at the correct position and size.
      The divider location is placed at 1000 pixels.

      ACTUAL -
      The window is made visible at an incorrect position and size. It is then maximized using an animation.
      The divider location is not positioned correctly.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFrame;
      import javax.swing.JSplitPane;
      import javax.swing.SwingUtilities;

      @SuppressWarnings("serial")
      public class MaximizeWindowTest extends JFrame
      {
      public static void main(String[] arguments)
      {
      SwingUtilities.invokeLater(new Runnable()
      {
      @Override
      public void run()
      {
      JSplitPane splitPane = new JSplitPane();

      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
      frame.setSize(200, 200);
      frame.setLocation(400, 400);
      frame.add(splitPane);
      frame.setExtendedState(MAXIMIZED_BOTH);

      splitPane.setDividerLocation(1000);

      frame.setVisible(true);
      }
      });
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      A possible workaround would be to set the size of the jframe to that of a maximized frame instead of relying on setExtendedState. The problem with this is that when the user would use the zoom button (green plus button in the window) it would no longer resize the window to its preferred smaller size.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: