RFR: 8301606: JFileChooser file chooser details view "size" label cut off in Metal Look&Feel
Phil Race
prr at openjdk.org
Thu Jun 15 22:49:00 UTC 2023
On Wed, 14 Jun 2023 09:17:06 GMT, Tejesh R <tr at openjdk.org> wrote:
> "size" label which is _RIGHT_ aligned is cut off on header cell. The issue is not only w.r.t to `JFileChooser` rather it is part of `JTable`. The root caused is found to be that in metal L&F the border insets is set to `(2,2,2,0)` meaning the right most inset value is 0. Hence when UIScaling increases the issue will be visible clearly. The fix addresses the issue by setting the right `inset` to 2 similar to other `inset` values. (Though the reason for setting it to 0 is unclear since it was initial load).
> CI testing shows green.
> After the fix at 225% scaling:
> 
This change will have broad impact everywhere the Border is used.
And it seems to me to be a workaround for the problem that Metal isn't
correctly calculating the length of the text at the scaled resolution.
SwingUtilities2.stringWidth() ought to be using the correct FontMetrics here for the scale.
Or perhaps its not being used at all.
So go find the code that does the measurement and then positions the text and understand why it is wrong.
Perhaps its rounding the x location incorrectly for the right aligned text ?
-------------
Changes requested by prr (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14464#pullrequestreview-1482487004
More information about the client-libs-dev
mailing list