On 10/25/2016 7:58 PM, Sergey Bylokhov wrote:

On 25.10.16 14:42, Alexandr Scherbatiy wrote:
When the Swing repaint manager paints Swing to a separate off-screen
buffer the root window is not painted. So in case of non-opaque root
window having transparent background the repainted buffer area
transparency is not restored and previously visible Swing components
can remain visible.

The solution is to paint the root window's background to the repainted
area in case the root window is non-opaque.
  Should the previous composite be restored after the rect filling?

Did you check that if the rootpane background contain non-zero alpha it does not draws twice? The first one when the the root will be draw itself and the second time in the new code when the component will be drawn? probably backbuffer should be initialized to Color(0,0,0,0) instead?
Probably you've confused that root is not an instance of the JRootPane. It is a HW container that is parent of the root pane. But there is an another color discrepancy here. Since the HW container is not opaque the background color should not be painted. But we fill background to clear the updated area. Probably the fill color should be Color(0,0,0,0) in this case but currently the getBackground() color is used if painting is executed without back buffer (see java.awt.Window#paint()). So, if I change this for the back buffer clear the result of painting will be different on different platforms and pipes. Also it seems this is the only way to have transparent but colored window background.

Reply via email to