RFR: JDK-8015739: Background of JInternalFrame is located out of JInternalFrame [v9]

Sergey Bylokhov serb at openjdk.org
Sat Oct 8 15:37:18 UTC 2022


On Fri, 7 Oct 2022 18:02:34 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> JInternalFrame background color seems to overflow into the border region. This issue is more prominently seen on Windows - Metal LAF (with fractional scaling, as shown below). The primary reason is border scaling issue as observed in - [JDK-8279614](https://bugs.openjdk.org/browse/JDK-8279614) 
>> 
>> The fix involves a similar approach as described here https://github.com/openjdk/jdk/pull/7449#issuecomment-1068218648. The test checks the midpoint and corners of borders to check if the internal frame's background color is located out of JInternalFrame.
>> 
>> ![image](https://user-images.githubusercontent.com/95945681/190233555-a7e00f2c-9003-4c11-84fb-207957838c2f.png)
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix for pixel color at edge, outermost border lines drawn as part of bulk of border

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 266:

> 264:             }
> 265: 
> 266:             Graphics2D g2d = (Graphics2D) g;

It could be a DebugGraphics which is not a Graphics2D

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 277:

> 275:             resetTransform = (at.getShearX() == 0) && (at.getShearY() == 0);
> 276: 
> 277:             if (resetTransform) {

Please clarify why we should reset the current transform? How it will work if the user sets a transform and render this to the BufferedImage.

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 292:

> 290:                 height = Region.clipRound(at.getScaleY() * h);
> 291:                 xtranslation = Region.clipRound(at.getScaleX() * x + at.getTranslateX());
> 292:                 ytranslation = Region.clipRound(at.getScaleY() * y + at.getTranslateY());

This probably should be refactored to something like this:
https://github.com/openjdk/jdk/blob/ec4fb47b90c9737dfdc285ebe98367a221c90c79/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java#L375

-------------

PR: https://git.openjdk.org/jdk/pull/10274



More information about the client-libs-dev mailing list