1 /* 2 * @(#)ContainerListener.java 1.11 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.awt.event; 9 10 import java.util.EventListener; 11 12 /** 13 * The listener interface for receiving container events. 14 * The class that is interested in processing a container event 15 * either implements this interface (and all the methods it 16 * contains) or extends the abstract <code>ContainerAdapter</code> class 17 * (overriding only the methods of interest). 18 * The listener object created from that class is then registered with a 19 * component using the component's <code>addContainerListener</code> 20 * method. When the container's contents change because a component 21 * has been added or removed, the relevant method in the listener object 22 * is invoked, and the <code>ContainerEvent</code> is passed to it. 23 * <P> 24 * Container events are provided for notification purposes ONLY; 25 * The AWT will automatically handle add and remove operations 26 * internally so the program works properly regardless of 27 * whether the program registers a <code>ComponentListener</code> or not. 28 * 29 * @see ContainerAdapter 30 * @see ContainerEvent 31 * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/containerlistener.html">Tutorial: Writing a Container Listener</a> 32 * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> 33 * 34 * @author Tim Prinzing 35 * @author Amy Fowler 36 * @version 1.11 12/19/03 37 * @since 1.1 38 */ 39 public interface ContainerListener extends EventListener { 40 /** 41 * Invoked when a component has been added to the container. 42 */ 43 public void componentAdded(ContainerEvent e); 44 45 /** 46 * Invoked when a component has been removed from the container. 47 */ 48 public void componentRemoved(ContainerEvent e); 49 50 } 51