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

Maximizing JFrame's doesn't always work properly

XMLWordPrintable

      J2SE Version (please include all output from java -version flag):
        java version "1.6.0-ea"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b47)
        Java HotSpot(TM) Client VM (build 1.6.0-ea-b47, mixed mode, sharing)

      Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
        Yes

      Operating System Configuration Information (be specific):
        Microsoft Windows 2000 [Version 5.00.2195]

      Bug Description:
        Maximizing JFrame's doesn't always work properly

        When using JFrame.setDefaultLookAndFeelDecorated(true); and trying to
        maximize a frame that is already the same size as it's maximum size,
        maximize does not work properly. When not using
        setDefaultLookAndFeelDecorated or when the frame is a different size to
        begin with it appears to work fine.

      Steps to Reproduce (be specific):
        1) Run the code below
        2) Click on the maximize button
        (it should now show a minimize button and resizing edges like what would
         have been shown if you resized the frame between steps 1 and 2)

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

      public class Test {
        static {
          /** workaround for bug 4955840 */
          Toolkit.getDefaultToolkit().setDynamicLayout(true);
          System.setProperty("sun.awt.noerasebackground", "true");
         
          JFrame.setDefaultLookAndFeelDecorated(true);
        }

        public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
          Rectangle bounds = new Rectangle(100, 100, 500, 500);
          frame.setMaximizedBounds(bounds);
          frame.setBounds(bounds);
          frame.setVisible(true);
        }
      }

            Unassigned Unassigned
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: