JDK-8059328 : LineBorder paints left edge 1 extra pixel wider since JDK 8
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u20,9
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2014-09-26
  • Updated: 2022-06-22
  • Resolved: 2022-06-22
Related Reports
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
A standard Swing LineBorder of size 1 will paint the left border 2px wide. This happens since JRE 8. The exact same code on JRE 7 paints the left border 1px wide. This can be observed by running the BorderDemo sample (http://docs.oracle.com/javase/tutorial/uiswing/examples/components/BorderDemoProject/src/components/BorderDemo.java) on the Oracle web site . If you run it in JRE 7 it is fine, if you run it in JRE 8 it is not fine.


REGRESSION.  Last worked in version 8u11


REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
http://docs.oracle.com/javase/tutorial/uiswing/examples/components/BorderDemoProject/src/components/BorderDemo.java
---------- END SOURCE ----------


Comments
I could reproduce the problem where the left edge of LineBorder is 2 pixel wide on a High DPI display only, the display is set to 200%. Both 8u11 and 8u20 have this issue. See the attached screenshots of 8u20, 8u333 and Java 20 at 100% and 200% for reference. I could not reproduce the problem on a regular display where scale is set to 100%. Recent versions of Java 8 are auto-scaled by Windows on High DPI displays, so the issue cannot be reproduced any more. Java 11 and later support High DPI displays and adapt the UI to the scale set in the system settings. In fractional scale cases, some edges of the borders could be thicker than others. For example, running BorderDemo.java with a recent build of JDK 20 (mainline development) at 150% renders the left and top edges 2-pixel wide whereas the right and bottom edges remain 1-pixel wide. JDK-8279614 addressed this problem for EtchedBorder. JDK-8282958 deals with other types of borders.
22-06-2022

As regression labeled and introduced in 8u or 9 -- targeted to 10
17-02-2017

Approved by component triage team to defer
29-08-2016

SQE: JDK 9: OK to defer
29-08-2016

9-client-defer-candidate: No resource to fix it in jdk9.
29-08-2016