コード例 #1
0
 @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();
     }
   }
 }
コード例 #2
0
 /** Override the super class method to handle components if they have been hidden. */
 @Override
 public void move(int dx, int dy) {
   super.move(dx, dy);
   if (hideComponents && isResizing()) {
     // Want to make all components to have the same sizing as the current components
     copyBoundsToComponents();
   }
 }
コード例 #3
0
 @Override
 protected void initBounds(Graphics g) {
   super.initBounds(g);
   ensureTextInBounds(false);
   if (hideComponents) copyBoundsToComponents();
 }