diff --git a/src/windows/classes/sun/awt/windows/WComponentPeer.java b/src/windows/classes/sun/awt/windows/WComponentPeer.java index d697fd34047c707b90141afc5d8cf5feb0aa4d83..5a3cd2ddd8769cf0bb46e62954204c73a802c9f8 100644 --- a/src/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java @@ -556,24 +556,26 @@ public abstract class WComponentPeer extends WObjectPeer Component target = (Component)getTarget(); Window window = SunToolkit.getContainingWindow(target); - if (window != null && !window.isOpaque()) { - // Non-opaque windows do not support heavyweight children. - // Redirect all painting to the Window's Graphics instead. - // The caller is responsible for calling the - // WindowPeer.updateWindow() after painting has finished. - int x = 0, y = 0; - for (Component c = target; c != window; c = c.getParent()) { - x += c.getX(); - y += c.getY(); - } - + if (window != null) { Graphics g = ((WWindowPeer)window.getPeer()).getTranslucentGraphics(); + // getTranslucentGraphics() returns non-null value for non-opaque windows only + if (g != null) { + // Non-opaque windows do not support heavyweight children. + // Redirect all painting to the Window's Graphics instead. + // The caller is responsible for calling the + // WindowPeer.updateWindow() after painting has finished. + int x = 0, y = 0; + for (Component c = target; c != window; c = c.getParent()) { + x += c.getX(); + y += c.getY(); + } - g.translate(x, y); - g.clipRect(0, 0, target.getWidth(), target.getHeight()); + g.translate(x, y); + g.clipRect(0, 0, target.getWidth(), target.getHeight()); - return g; + return g; + } } SurfaceData surfaceData = this.surfaceData; diff --git a/src/windows/classes/sun/awt/windows/WWindowPeer.java b/src/windows/classes/sun/awt/windows/WWindowPeer.java index c5c979e34ec197378f6064fd9f3f1bf95de713eb..d3ccd4db4d91a852a67f21b0c63220c0e2268116 100644 --- a/src/windows/classes/sun/awt/windows/WWindowPeer.java +++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java @@ -594,16 +594,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, } } - @Override - public Graphics getGraphics() { - synchronized (getStateLock()) { - if (!isOpaque) { - return getTranslucentGraphics(); - } - } - return super.getGraphics(); - } - @Override public void setBackground(Color c) { super.setBackground(c);