private synchronized void setDebug(ComponentWrapper paramComponentWrapper, boolean paramBoolean) { if ((paramBoolean) && ((this.debugTimer == null) || (this.debugTimer.getDelay() != getDebugMillis()))) { if (this.debugTimer != null) this.debugTimer.stop(); ContainerWrapper localContainerWrapper = paramComponentWrapper.getParent(); Component localComponent = localContainerWrapper != null ? (Component) localContainerWrapper.getComponent() : null; this.debugTimer = new Timer(getDebugMillis(), new MyDebugRepaintListener(this, null)); if (localComponent != null) SwingUtilities.invokeLater( new Runnable(localComponent) { public void run() { Container localContainer = this.val$parent.getParent(); if (localContainer != null) if ((localContainer instanceof JComponent)) { ((JComponent) localContainer).revalidate(); } else { this.val$parent.invalidate(); localContainer.validate(); } } }); this.debugTimer.setInitialDelay(100); this.debugTimer.start(); } else if ((!paramBoolean) && (this.debugTimer != null)) { this.debugTimer.stop(); this.debugTimer = null; } }
private void adjustWindowSize(ContainerWrapper paramContainerWrapper) { BoundSize localBoundSize1 = this.lc.getPackWidth(); BoundSize localBoundSize2 = this.lc.getPackHeight(); if ((localBoundSize1 == null) && (localBoundSize2 == null)) return; Window localWindow = (Window) SwingUtilities.getAncestorOfClass( Window.class, (Component) paramContainerWrapper.getComponent()); if (localWindow == null) return; Dimension localDimension = localWindow.getPreferredSize(); int i = constrain( checkParent(localWindow), localWindow.getWidth(), localDimension.width, localBoundSize1); int j = constrain( checkParent(localWindow), localWindow.getHeight(), localDimension.height, localBoundSize2); int k = Math.round( localWindow.getX() - (i - localWindow.getWidth()) * (1.0F - this.lc.getPackWidthAlign())); int m = Math.round( localWindow.getY() - (j - localWindow.getHeight()) * (1.0F - this.lc.getPackHeightAlign())); localWindow.setBounds(k, m, i, j); }
public void layoutContainer(Container paramContainer) { synchronized (paramContainer.getTreeLock()) { checkCache(paramContainer); Insets localInsets = paramContainer.getInsets(); int[] arrayOfInt = { localInsets.left, localInsets.top, paramContainer.getWidth() - localInsets.left - localInsets.right, paramContainer.getHeight() - localInsets.top - localInsets.bottom }; if (this.grid.layout( arrayOfInt, this.lc.getAlignX(), this.lc.getAlignY(), getDebug(), true)) { this.grid = null; checkCache(paramContainer); this.grid.layout(arrayOfInt, this.lc.getAlignX(), this.lc.getAlignY(), getDebug(), false); } long l = this.grid.getHeight()[1] + (this.grid.getWidth()[1] << 32); if (this.lastSize != l) { this.lastSize = l; ContainerWrapper localContainerWrapper = checkParent(paramContainer); Window localWindow = (Window) SwingUtilities.getAncestorOfClass( Window.class, (Component) localContainerWrapper.getComponent()); if (localWindow != null) if (localWindow.isVisible()) SwingUtilities.invokeLater( new Runnable(localContainerWrapper) { public void run() { MigLayout.this.adjustWindowSize(this.val$containerWrapper); } }); else adjustWindowSize(localContainerWrapper); } this.lastInvalidSize = null; } }