Example usage for javax.swing JComponent removeAll

List of usage examples for javax.swing JComponent removeAll

Introduction

In this page you can find the example usage for javax.swing JComponent removeAll.

Prototype

public void removeAll() 

Source Link

Document

Removes all the components from this container.

Usage

From source file:Main.java

/**
 * Remove all children from a JCompontent and remove all
 * PropertyChangeListeners for all children recursively.
 *
 * @param container//from w  w  w.  j  a  va  2s.c  om
 */
public static void safeRemoveAll(JComponent container) {
    //remove all children PropertyChangeListeners
    if (container.getComponentCount() > 0) {
        for (Component child : container.getComponents()) {
            removeAllPropertyChangeListeners((JComponent) child);
        }
    }
    //remove all children
    container.removeAll();
}

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Put all StatisticGrafic instances into panel.
 * Store panel as StatisticGrafic.statisticPanel.
 * @param panel/*from   ww w  .  j  a  va  2 s . c  o m*/
 */
public static void updateInit(Model model, String viewId, JComponent panel) {
    //System.out.println("StatisticGrafic.updateInit   ");
    StatisticGrafic.statisticPanel = panel;
    panel.removeAll();
    String[] id = model.getStatistics().getAllIds();
    for (int i = 0; i < id.length; i++) {
        Statistic statistik = model.getStatistics().get(id[i]);
        StatisticGrafic statistikGrafic = (StatisticGrafic) statistik.getGrafic();
        if (statistikGrafic != null && statistikGrafic.getViewId().equals(viewId)) {
            statistikGrafic.transform();
            panel.add(statistikGrafic);
            //System.out.println("StatisticGrafic.updateInit   "+statistik.getId());
        }
    }
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.browser.BrowserModel.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#resetChildDisplay()/*from   ww  w .j a va2s.  co m*/
 */
public void resetChildDisplay() {
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Collection<ImageDisplay> rootChildren = rootDisplay.getChildrenDisplay();
    JComponent desktop = rootDisplay.getInternalDesktop();
    desktop.removeAll();
    Iterator<ImageDisplay> i;
    switch (selectedLayout.getIndex()) {
    case LayoutFactory.SQUARY_LAYOUT:
        i = rootChildren.iterator();
        ImageDisplay child;
        while (i.hasNext()) {
            child = i.next();
            desktop.add(child);
            addToDesktop(child);
        }
        break;

    case LayoutFactory.FLAT_LAYOUT:
        i = getImageNodes().iterator();
        while (i.hasNext())
            desktop.add(i.next());
    }
    rootDisplay.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}