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

Alexey Ivanov aivanov at openjdk.java.net
Tue Jun 7 21:21:50 UTC 2022


On Mon, 6 Jun 2022 20:46:03 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Changed the drawing area to be increased by 0.5 on the left side to prevent clipping
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   skip transform is m01 or m10 is nonzero

I played a bit with rotation and shear on the graphics where the panel is painted. It works as coded: the border is painted as before. If only scale is applied, the fix works well and borders are painted without any gaps and with the correct width.

There are two unused imports in the test.

src/java.desktop/share/classes/javax/swing/border/EtchedBorder.java line 180:

> 178:         int xtranslation;
> 179:         int ytranslation;
> 180:         if(resetTransform) {

A space between `if` and `(`, please. And at line 167 too.

test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java line 178:

> 176:         JFrame frame;
> 177:         JPanel contentPanel;
> 178:         JPanel childPanel;

There's no need to declare them in advance. Declare each variable where it's used for the first time.

test/jdk/javax/swing/border/EtchedBorder/ScaledEtchedBorderTest.java line 194:

> 192:             contentPanel.add(childPanel);
> 193:             childSize = childPanel.getPreferredSize();
> 194:             childPanel.setBounds(0, childSize.height * i, childSize.width, childSize.height);

Yes, the previous version was incorrect. The idea here was to calculate the preferred size only once and re-use it.


            if (childSize == null) {
                childSize = childPanel.getPreferredSize();
            }
            childPanel.setBounds(0, childSize.height * i, childSize.width, childSize.height);

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

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



More information about the client-libs-dev mailing list