Example usage for javax.swing JFrame addContainerListener

List of usage examples for javax.swing JFrame addContainerListener

Introduction

In this page you can find the example usage for javax.swing JFrame addContainerListener.

Prototype

public synchronized void addContainerListener(ContainerListener l) 

Source Link

Document

Adds the specified container listener to receive container events from this container.

Usage

From source file:Main.java

public static void main() {

    ContainerListener listener = new ContainerAdapter() {
        public void componentAdded(ContainerEvent evt) {

            Component c = evt.getChild();
        }/*www.  j a  va2  s.  co  m*/

        public void componentRemoved(ContainerEvent evt) {

            Component c = evt.getChild();
        }
    };

    JFrame frame = new JFrame();
    frame.addContainerListener(listener);
}