RFR: 8301606: JFileChooser file chooser details view "size" label cut off in Metal Look&Feel

Alexey Ivanov aivanov at openjdk.org
Thu Jun 15 09:02:57 UTC 2023


On Thu, 15 Jun 2023 08:15:44 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> And also it's not possible to verify with background color because anti-aliasing, I guess.
>
>> And also it's not possible to verify with background color because anti-aliasing, I guess.
> 
> Why is it? There's no background anti-aliasing, the background is filled with solid color.
> 
> You need to use [Robot.createMultiResolutionScreenCapture](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/Robot.html#createMultiResolutionScreenCapture(java.awt.Rectangle)) to get the real screen pixels rather than scaled down image as if uiScale=1.0.
> 
> You may need to tweak the position of the capture and the area where you sample the pixels.

It is even simpler. The bug is not `JFileChooser`-specific, it affects each and every `JTable` which has a right-aligned column. Write the test for `JTable` instead. You can have a single right-aligned column with the header text that you control (a lower case letter ‘l’ will do it greatly). You can render the table into a `BufferedImage` with the scale you need (2.25) and then analyse the pixels in the image.

As simple as that. It's not necessary to create real UI for this kind of test.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14464#discussion_r1230684004



More information about the client-libs-dev mailing list