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