Example usage for java.awt Component doLayout

List of usage examples for java.awt Component doLayout

Introduction

In this page you can find the example usage for java.awt Component doLayout.

Prototype

public void doLayout() 

Source Link

Document

Prompts the layout manager to lay out this component.

Usage

From source file:net.imglib2.script.analysis.ChartUtils.java

private static final void layoutComponent(final Component c) {
    synchronized (c.getTreeLock()) {
        c.doLayout();
        if (c instanceof Container) {
            for (final Component child : ((Container) c).getComponents()) {
                layoutComponent(child);/*  w  w  w. j a  v  a  2s.c  om*/
            }
        }
    }
    c.validate();
}

From source file:script.imglib.analysis.ChartUtils.java

private static final void layoutComponent(final Component c) {
    synchronized (c.getTreeLock()) {
        c.doLayout();
        if (c instanceof Container) {
            for (Component child : ((Container) c).getComponents()) {
                layoutComponent(child);/*from w w  w.j  a  v  a2s .c  o m*/
            }
        }
    }
    c.validate();
}

From source file:Main.java

public static void doLayoutTree(java.awt.Component c) {
    //c.doLayout();
    if (c instanceof java.awt.Container) {
        java.awt.Container container = (java.awt.Container) c;
        for (java.awt.Component component : container.getComponents()) {
            doLayoutTree(component);//w  ww  .j a  v a 2s  .  co  m
        }
    }
    c.doLayout();
}

From source file:com.simiacryptus.util.Util.java

/**
 * Layout./* w w w . j av a 2s  .c om*/
 *
 * @param c the c
 */
public static void layout(@javax.annotation.Nonnull final Component c) {
    c.doLayout();
    if (c instanceof Container) {
        Arrays.stream(((Container) c).getComponents()).forEach(com.simiacryptus.util.Util::layout);
    }
}

From source file:edu.ku.brc.af.core.NavBox.java

/**
 * Refreshes - meaning it makes sure it is resized (layed out) and drawn.
 * @param nbi the box to refresh/*from   w  w  w .j  a v  a 2 s.  c  om*/
 */
public static void refresh(final NavBoxItemIFace nbi) {
    if (nbi != null) {
        Component comp = nbi.getUIComponent();
        comp.invalidate();
        comp.doLayout();
        comp.setSize(comp.getPreferredSize());
        comp.repaint();
        log.debug("comp " + comp.getPreferredSize() + " " + comp.getSize()); //$NON-NLS-1$ //$NON-NLS-2$

        Container parentComp = nbi.getUIComponent().getParent();
        if (parentComp instanceof NavBox) {
            refresh((NavBox) parentComp);
        } else if (parentComp instanceof JScrollPane) {
            // this must be a scrollable NavBox;
            // let's get the actual NavBox
            // container heirarchy is NavBox -> JScrollPane -> NavBoxItem
            parentComp = parentComp.getParent().getParent();
            refresh((NavBox) parentComp);
        }
    }
}

From source file:edu.ku.brc.af.prefs.PreferencesDlg.java

/**
 * @param comp//from   ww  w.j  a  v a  2 s. c o  m
 * @param oldSize
 */
protected void showAndResizePane(final Component comp, final Dimension oldSize) {
    mainPanel.remove(currentComp);

    currentComp.setVisible(false);
    mainPanel.add(comp, BorderLayout.CENTER);
    comp.invalidate();
    comp.validate();
    comp.invalidate();
    comp.doLayout();
    comp.repaint();
    doLayout();
    repaint();
    currentComp = comp;
    currentComp.setVisible(true);

    Dimension oldWinDim = getSize();
    Dimension winDim = getSize();
    winDim.width += currentComp.getPreferredSize().width - oldSize.width;
    winDim.width = Math.max(winDim.width, 400);
    winDim.height = Math.max(winDim.height, 250);

    Dimension pSize = prefsToolbar.getPreferredSize();
    winDim.width = Math.max(winDim.width, pSize.width + 30);

    if (winDim.equals(oldWinDim)) // needed because JGoodies doesn't want to relayout when it is the same size.
    {
        winDim.height += 2;
    }
    setSize(winDim);
    currentComp.setSize(new Dimension(currentComp.getPreferredSize().width, oldSize.height));

    // Not sure why this combination works
    mainPanel.invalidate();
    mainPanel.validate();
    mainPanel.invalidate();
    mainPanel.doLayout();
    mainPanel.repaint();

    invalidate();
    validate();
    invalidate();
    doLayout();

    doLayout();
    repaint();
    // to here

    ((PrefsPanelIFace) comp).setShadeColor(null);

    // Without Animation
    comp.setVisible(true);
    winDim.height += currentComp.getPreferredSize().height - oldSize.height;
    winDim.height = Math.max(winDim.height, 250);
    setSize(winDim);
}