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

Alisen Chung achung at openjdk.org
Mon Oct 3 22:07:13 UTC 2022


On Fri, 30 Sep 2022 00:19:46 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:
> 
>   removed redundant jtreg header

Changes requested by achung (Author).

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

> 253:          * @return a {@code int} which is the rounded value of provided number
> 254:          */
> 255:         private static int roundDown(double d)

The name of this method is a bit misleading, the operation doesn't actually round down, but rounds the number normally except for the x.5 case right? Does this operation exist somewhere else?

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

> 327: 
> 328:             // Draw the bulk of the border
> 329:             for (int i = 1; i <= loopCount; i++) {

Should we redo the drawing of this border to use Graphics2D fillRect instead?

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

> 334:                 // Draw the Long highlight lines
> 335:                 g.setColor(highlight);
> 336:                 g.drawLine(scaledCorner + 1, midPoint+stkWidth,

The spacing here and when drawing shadow lines is a bit inconsistent

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

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



More information about the client-libs-dev mailing list