/** * A private helper method that checks, whether the component provides an own peer. * * @return true, if the component has an own peer, false otherwise. */ protected final boolean isOwnPeerConnected() { if (allowOwnPeer == false) { return false; } final Window windowAncestor = ComponentDrawable.getWindowAncestor(component); return (windowAncestor != null && windowAncestor != peerSupply); }
/** Draws the drawable. */ public void run() { try { final Component component = getComponent(); if (component instanceof Window) { final Window w = (Window) component; w.validate(); } else if (isOwnPeerConnected()) { final Window w = ComponentDrawable.getWindowAncestor(component); if (w != null) { w.validate(); } } else { peerSupply.pack(); contentPane.add(component); } component.setBounds( (int) area.getX(), (int) area.getY(), (int) area.getWidth(), (int) area.getHeight()); component.validate(); component.paint(graphics); } finally { cleanUp(); } }