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

JFrame.setResizable(false) gives different frame size & title height from Java 8

XMLWordPrintable

    • 9
    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Operating System: Microsoft Windows [Version 10.0.16299.371] (Windows 10 with 1709)
      Java: Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
      java: Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      The following demo source gives different JFrame size and title height from that on Java 8, if JFrame.setResizable(false) is not called frame size on Java 9/10 is same as that on Java 8.

      This problem can be repeated with both Java 9.0.4 and Java 10.0.1 (download from Oracle).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Java 8 / Java 9 / Java 10 gives same appearance.
      ACTUAL -
      Java 9 / Java 10 gives different frame size and title height from Java 8.

      ---------- BEGIN SOURCE ----------
      public class FirstFrame extends JFrame
      {
      public FirstFrame()
      {
      JToolBar statusbar = new JToolBar();

      statusbar.add(new JLabel("Status:"));
      getContentPane().add(statusbar, BorderLayout.SOUTH);

      setSize(new Dimension(300, 300));
      setResizable(false); // problem comes here.

      super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      super.setVisible(true);
      }

      public static void main(String[] args) throws Exception
      {
      new FirstFrame();
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        1. Capture_10.PNG
          6 kB
        2. Capture_8u171.PNG
          4 kB
        3. FirstFrame.java
          0.6 kB

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: