RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v15]

Alexey Ivanov aivanov at openjdk.java.net
Tue May 17 20:42:04 UTC 2022


On Tue, 17 May 2022 20:25:22 GMT, Phil Race <prr at openjdk.org> wrote:

>> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   renamed test, renamed some methods, updated error messages, updated test
>
> src/java.desktop/share/classes/javax/swing/border/EtchedBorder.java line 159:
> 
>> 157:         int stkWidth = 1;
>> 158:         if (g instanceof Graphics2D) {
>> 159:             at = ((Graphics2D) g).getTransform();
> 
> We more usually write
> Graphics2D g2d = (Graphics2D)g
> 
> then just use g2d instead of repeated casting.

This could even use pattern matching:

        if (g instanceof Graphics2D g2d) {
            at = g2d.getTransform();

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

PR: https://git.openjdk.java.net/jdk/pull/7449



More information about the client-libs-dev mailing list