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

Phil Race prr at openjdk.java.net
Wed May 18 10:37:18 UTC 2022


On Tue, 17 May 2022 20:38:07 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> 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();

I thought about that but (1) couldn't remember off-hand if it was still preview, (2) I was sure it would impede a backport ...

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

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



More information about the client-libs-dev mailing list