RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v2]
Phil Race
prr at openjdk.java.net
Fri Mar 11 19:05:44 UTC 2022
On Fri, 4 Mar 2022 00:49:39 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 three additional commits since the last revision:
>
> - adjusted pixels to check for border
> - typo
> - reverted old change, swapped order of painting to prevent overdrawing
src/java.desktop/share/classes/javax/swing/border/EtchedBorder.java line 139:
> 137: g.translate(x, y);
> 138:
> 139: if (etchType == LOWERED) {
So if you think we need to draw the darker colour - shadow - 2nd then please add a comment here.
Also I don't like the repeated blocks of code and I can't follow what they represent
could we have something like
<pre>
drawFoo(Graphics g, Color, c, int w, int h) {
g.setColor(c);
g.drawLine(1, h-3, 1, 1);
g.drawLine(1, 1, w-3, 1);
g.drawLine(0, h-1, w-1, h-1);
g.drawLine(w-1, h-1, w-1, 0);
}
drawBar(Graphics g, Color c, int w, int h) {
g.setColor(c);
g.drawRect(0, 0, w-2, h-2);
}
then it would become
if (etchType == LOWERED) {
drawFoo(g, getHighlightColor(c), w, h);
drawBar(g, getShadowColor(c), w, h);
} else {
drawBar(g, getHighlightColor(c)w, h);
drawFoo(g, getShadowColor(c), w, h);
</pre>
and of course we won't use "Foo" and "Bar" but something that actually represents what these do .. .which really isn't clear to me
Is "Bar" something like "Border" and "Foo" ... hmm I don't know.
src/java.desktop/share/classes/javax/swing/border/EtchedBorder.java line 162:
> 160:
> 161:
> 162: g.translate(-x-1, -y);
Why is this translate changed ?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7449
More information about the client-libs-dev
mailing list