JDK-8202015 : JFrame.setResizable(false) gives different frame size & title height from Java 8
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9,10,11
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2018-04-19
  • Updated: 2018-07-31
  • Resolved: 2018-07-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12Resolved
Description
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



Comments
JDK9 introduced hidpi support and windows10 uses 125% or 150% scaling so frame size is bigger. To get the same size as jdk8, you need to use -Dsun.java2d.uiScale=1.0 in which case same frame size will be displayed.
31-07-2018

Reported with JDk 10.0.1 and Windows 10, The JFrame size and title height is observed to be different from JDK 8, when checked against JDK 9 and onward. Results: =========== 8: OK 8u172: OK 9: Fail 10: Fail 11 ea b09: Fail The change has appeared from JDK 8 to JDK 9 and onwards. The size differed when comapred to JDK 8. This can be considered as regression in JDK 9 and onwards. See attached screenshot as reference. To verify, run the attached test case with respective JDK versions.
19-04-2018