Example usage for java.awt Component.Container add

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

Introduction

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

Prototype

public void add(PopupMenu popup) 

Source Link

Document

Adds the specified popup menu to 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();
                }/*w  w  w . j a  v a  2s. co  m*/
            }
            container.remove(c);
        }
        container.add(frame);
    } else {
        throw new IllegalStateException(
                "Parent component must be com.haulmont.cuba.gui.components.Component.Container");
    }
}