JDK-8294680 : Refactor scaled border rendering
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 11,17,19,20
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-09-30
  • Updated: 2025-09-26
  • Resolved: 2023-01-19
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 17 JDK 21
17.0.18Fixed 21 b07Fixed
Related Reports
Blocks :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
There are several issues which deal with border rendering. The first one was JDK-8279614, it dealt with EtchedBorder.

The next one is JDK-8015739. It uses the same approach. Now that two borders are fixed, it is time to refactor the approach to avoid duplicate code.

I propose adding a utility method to SwingUtilities3:

1. Reset the transform;
2. Call the passed interface* to render the unscaled border;
3. Restore the transform.

It will unify border rendering. Other border types will use the utility method.

* The method which renders the border with unscaled Graphics could be a private method in the calling class, method reference could be passed to the utility method.
Comments
Fix request [17u] I backport this to straeamline tests in 17. Risk limited to awt. Although this is just a refactoring we should take the risk of backporting this as it simplifies later backports and thus reduces risk overall. Related issues are either in 17 or will be addressed. Tests pass. SAP nightly testing passes.
26-09-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/3984 Date: 2025-09-22 15:36:27 +0000
22-09-2025

Changeset: 80ab50b3 Author: Harshitha Onkar <honkar@openjdk.org> Date: 2023-01-19 18:43:54 +0000 URL: https://git.openjdk.org/jdk/commit/80ab50b3389cbdae6bced7cea3f3a84b94c5bb82
19-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11571 Date: 2022-12-07 21:34:12 +0000
07-12-2022

Add instance of check before converting Graphics object to Graphics 2D.
07-11-2022