RFR: 8187759: Background not refreshed when painting over a transparent JFrame [v4]
Tejesh R
tr at openjdk.org
Tue Feb 20 05:40:01 UTC 2024
On Tue, 20 Feb 2024 05:34:00 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/BufferStrategyPaintManager.java line 252:
>>
>>> 250: g2d.setBackground(paintingComponent.getBackground());
>>> 251: g2d.clearRect(x, y, w, h);
>>> 252: g2d.setBackground(oldBg);
>>
>> I wonder what color should we use to clear the background? Should it be background color of the component, background color of the window, or (0,0,0)? What the Swing components usually do in that case?
>
> Since this is an intermediate buffer its content should not affect the rendering, so it should contain only the image rendered by the component itself.
This how it is done in [RepaintManager](https://github.com/openjdk/jdk/blob/69a11c7f7ea7c4195a8ee56391bdf04c75bd8156/src/java.desktop/share/classes/javax/swing/RepaintManager.java#L1711), it uses background color of the component.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17081#discussion_r1495265755
More information about the client-libs-dev
mailing list