RFR: JDK-8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled [v4]
Alexey Ivanov
aivanov at openjdk.org
Tue Feb 7 20:55:57 UTC 2023
On Fri, 3 Feb 2023 22:43:22 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>> FrameBorder and DialogBorder had border scaling issues similar to JInternalFrame. This fix addresses it by creating `AbstractMetalBorder` class within MetalBorder, that contains the common steps required for painting border for `FrameBorder`, `DialogBorder` and `InternalFrameBorder`.
>>
>> All 3 cases - JFrame, JDialog and JInternalFrame are combined into a single test case - `ScaledMetalBorderTest` and hence the older `InternalFrameBorderTest` which is no longer required, is deleted.
>
> Harshitha Onkar has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
>
> - review changes: AbstractMetalWindowBorder, strokeWidth rename
> - Merge branch 'master' into MetalBorderRefactor_8294484
> - minor change
> - removed unused import
> - added updateColor(), isActive() to MetalBorder
> - test summary changes
> - deleted InternalFrameBorderTest
> - moved corner var to AbstractMetalBorder
> - sealed abstract class, record changes
> - initial commit, consolidated test case
Changes requested by aivanov (Reviewer).
src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 281:
> 279:
> 280: // scaled thickness
> 281: int thickness = (int) Math.ceil(4 * scaleFactor);
Suggestion:
updateColors(c);
// scaled thickness
int thickness = (int) Math.ceil(4 * scaleFactor);
g.setColor(background);
Setting the background color logically belongs to painting the bulk of the border rather than updating the colors.
src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 376:
> 374: public Insets getBorderInsets(Component c, Insets newInsets) {
> 375: newInsets.set(4, 4, 4, 4);
> 376: return newInsets;
For consistency with compositing the implementation, it should be:
Suggestion:
return border.getInsets(newInsets);
-------------
PR: https://git.openjdk.org/jdk/pull/12391
More information about the client-libs-dev
mailing list