Example usage for java.awt Component.Container remove

List of usage examples for java.awt Component.Container remove

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public void remove(MenuComponent popup) 

Source Link

Document

Removes the specified popup menu from the component.

Usage

From source file:com.haulmont.cuba.desktop.sys.DesktopWindowManager.java

@Override
protected void showFrame(Component parent, Frame frame) {
    // the same as web window manager does
    if (parent instanceof Component.Container) {
        Component.Container container = (Component.Container) parent;
        for (Component c : container.getComponents()) {
            if (c instanceof Component.Disposable) {
                Component.Disposable disposable = (Component.Disposable) c;
                if (!disposable.isDisposed()) {
                    disposable.dispose();
                }//  ww w .  j av  a2  s .c o m
            }
            container.remove(c);
        }
        container.add(frame);
    } else {
        throw new IllegalStateException(
                "Parent component must be com.haulmont.cuba.gui.components.Component.Container");
    }
}