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

JFrame size greater than expected (ExtendedState=MAXIMIZED_BOTH,Resizable=false)

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10
      Java 8

      A DESCRIPTION OF THE PROBLEM :
      When following code is run, frame size greater than screen and location is set out of screen.
      (ex: Bounds = (-8, -8, 1936, 1056), Windows task bar is on bottom )

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

                          @Override
                          public void run() {
                              JFrame frame = new JFrame();
                              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                              // frame.setExtendedState(frame.getExtendedState() | java.awt.Frame.MAXIMIZED_BOTH);
                              frame.setBounds(-2, -2, 1924, 1044);
                              frame.setVisible(true);
                              frame.setResizable(false);
                          }
                      });
          }

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
          public static void main(String[] args){
                      SwingUtilities.invokeLater(new Runnable() {

                          @Override
                          public void run() {
                              JFrame frame = new JFrame();
                              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                              // frame.setExtendedState(frame.getExtendedState() | java.awt.Frame.MAXIMIZED_BOTH);
                              frame.setBounds(-2, -2, 1924, 1044);
                              frame.setVisible(true);
                              frame.setResizable(false);
                          }
                      });
          }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Maximized frame
      ACTUAL -
      Frame is greater than maximized frame

      ---------- BEGIN SOURCE ----------
          public static void main(String[] args){
                      SwingUtilities.invokeLater(new Runnable() {

                          @Override
                          public void run() {
                              JFrame frame = new JFrame();
                              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                              // frame.setExtendedState(frame.getExtendedState() | java.awt.Frame.MAXIMIZED_BOTH);
                              frame.setBounds(-2, -2, 1924, 1044);
                              frame.setVisible(true);
                              frame.setResizable(false);
                          }
                      });
          }
      ---------- END SOURCE ----------

      FREQUENCY : always


            aivanov Alexey Ivanov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: