/** * Handles this components ancestor being added to a container. Registers this component as a * listener for size changes on the ancestor so that we may un-cache the prefereed size and force * a recalculation. * * @param event The heirarchy event. */ public void hierarchyChanged(final HierarchyEvent event) { if (0 != (event.getChangeFlags() & HierarchyEvent.PARENT_CHANGED)) { Component dad = event.getChanged(); Component parent = getParent(); if ((null != parent) && (parent.getParent() == dad)) dad.addComponentListener(this); } }
public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) { Window parentWindow = SwingUtilities.getWindowAncestor(BufferedCanvasComponent.this); if (lastParentWindow != parentWindow) { if (lastParentWindow != null) lastParentWindow.removeWindowListener(VisibilityHandler.this); if (parentWindow != null) parentWindow.addWindowListener(VisibilityHandler.this); lastParentWindow = parentWindow; } } if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { if (isShowing()) BufferedCanvasComponent.this.shown(); else BufferedCanvasComponent.this.hidden(); } }
@Override public void hierarchyChanged(HierarchyEvent hierarchyEvent) { if ((hierarchyEvent.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { if (!getSampler().isRunning()) { getSampler().start(); } } }
// we don't want the animation to keep running if we're not displayable public void hierarchyChanged(HierarchyEvent he) { if ((he.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) { if (progressBar.isIndeterminate()) { if (progressBar.isDisplayable()) { startAnimationTimer(); } else { stopAnimationTimer(); } } } }
@Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { if (isShowing()) { controller.addControllerListener(this); update(); } else { controller.removeControllerListener(this); } } }
@Override public void hierarchyChanged(HierarchyEvent event) { if ((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) { if (isDisplayable()) { // for (Tile tile: dimension.getTiles()) { // threeDeeRenderManager.renderTile(tile); // } timer = new Timer(250, this); timer.start(); } else { timer.stop(); timer = null; threeDeeRenderManager.stop(); for (Tile tile : dimension.getTiles()) { tile.removeListener(this); } dimension.removeDimensionListener(this); } } }