JDK-8307447 : EtchedBorder inset by 1 pixel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 11.0.19
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2023-04-24
  • Updated: 2023-05-04
Description
ADDITIONAL SYSTEM INFORMATION :
This affects Java 11.0.19 on Ubuntu (I've logged 11.0.18 because 11.0.19 was not available to select from the release list).

A DESCRIPTION OF THE PROBLEM :
EtchedBorder no longer 'borders' a JLabel correctly, instead being inset by 1 pixel along the bottom and right edges. It's a subtle difference - I've included images to demonstrate the difference:

Java 11.0.18 (correct): <LINK>
Java 11.0.19 (incorrect): <LINK>

I only spotted this due to automated screenshot tests which began failing when my Github actions pipeline auto-bumped from 11.0.18 -> 11.0.19. Pinning the version to 11.0.18 has resolved the issue.

REGRESSION : Last worked in version 11.0.18

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Construct a JLabel with an EtchedBorder and compare the results on 11.0.18 vs 11.0.19

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The EtchedBorder is around the outside of the component.
ACTUAL -
The EtchedBorder is inset slightly in the bottom and right edges

---------- BEGIN SOURCE ----------
JLabel label = new JLabel();
label.setSize(new Dimension(150, 150));
label.border = EtchedBorder(EtchedBorder.RAISED, null, null);
label.icon = //some icon...
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Pinning to 11.0.18 has worked around this for me

FREQUENCY : always



Comments
Checked with attached testcase, issue is reproducible<attached screenshot> Test observation ============ The bottom and right edges, are inset by 1 pixel
04-05-2023