--- old/src/macosx/classes/sun/lwawt/LWComponentPeer.java 2013-04-23 19:12:03.864634800 +0400 +++ new/src/macosx/classes/sun/lwawt/LWComponentPeer.java 2013-04-23 19:12:03.656622900 +0400 @@ -93,12 +93,12 @@ // the container peer is not null, which might also be false if // addNotify() is called for a component outside of the hierarchy. // The exception is LWWindowPeers: their parents are always null - private LWContainerPeer containerPeer; + private final LWContainerPeer containerPeer; // Handy reference to the top-level window peer. Window peer is // borrowed from the containerPeer in constructor, and should also // be updated when the component is reparented to another container - private LWWindowPeer windowPeer; + private final LWWindowPeer windowPeer; private final AtomicBoolean disposed = new AtomicBoolean(false); @@ -183,13 +183,14 @@ this.target = target; this.platformComponent = platformComponent; - initializeContainerPeer(); // Container peer is always null for LWWindowPeers, so // windowPeer is always null for them as well. On the other // hand, LWWindowPeer shouldn't use windowPeer at all - if (containerPeer != null) { - windowPeer = containerPeer.getWindowPeerOrSelf(); - } + final Container parent = SunToolkit.getNativeContainer(target); + containerPeer = (LWContainerPeer) LWToolkit.targetToPeer(parent); + windowPeer = containerPeer != null ? containerPeer.getWindowPeerOrSelf() + : null; + // don't bother about z-order here as updateZOrder() // will be called from addNotify() later anyway if (containerPeer != null) { @@ -356,15 +357,6 @@ return containerPeer; } - // Just a helper method - // Overridden in LWWindowPeer to skip containerPeer initialization - protected void initializeContainerPeer() { - Container parent = LWToolkit.getNativeContainer(target); - if (parent != null) { - containerPeer = (LWContainerPeer) LWToolkit.targetToPeer(parent); - } - } - public PlatformWindow getPlatformWindow() { LWWindowPeer windowPeer = getWindowPeer(); return windowPeer.getPlatformWindow();