@Override public void hideComponents(boolean hide) { this.hideComponents = hide; if (componentsInHiearchy == null) return; for (Renderable r : componentsInHiearchy) { Node node = (Node) r; node.setIsVisible(!hide); if (r instanceof RenderableComplex) { ((RenderableComplex) r).hideComponents = hide; } } // The following statements are related to bounds. if (bounds == null) return; if (hide) { saveOldBounds(); copyBoundsToComponents(); } else { recoverOldBounds(); // Make sure a complex container has enough size Renderable container = this.container; Rectangle childBounds = this.bounds; while (container instanceof RenderableComplex) { Rectangle cBounds = container.getBounds(); if (!cBounds.contains(childBounds)) { ((RenderableComplex) container).layout(); } childBounds = container.getBounds(); container = container.getContainer(); } } }