src/share/classes/java/awt/event/ContainerAdapter.java

Print this page




  27 
  28 /**
  29  * An abstract adapter class for receiving container events.
  30  * The methods in this class are empty. This class exists as
  31  * convenience for creating listener objects.
  32  * <P>
  33  * Extend this class to create a <code>ContainerEvent</code> listener
  34  * and override the methods for the events of interest. (If you implement the
  35  * <code>ContainerListener</code> interface, you have to define all of
  36  * the methods in it. This abstract class defines null methods for them
  37  * all, so you can only have to define methods for events you care about.)
  38  * <P>
  39  * Create a listener object using the extended class and then register it with
  40  * a component using the component's <code>addContainerListener</code>
  41  * method. When the container's contents change because a component has
  42  * been added or removed, the relevant method in the listener object is invoked,
  43  * and the <code>ContainerEvent</code> is passed to it.
  44  *
  45  * @see ContainerEvent
  46  * @see ContainerListener
  47  * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/containerlistener.html">Tutorial: Writing a Container Listener</a>
  48  *
  49  * @author Amy Fowler
  50  * @since 1.1
  51  */
  52 public abstract class ContainerAdapter implements ContainerListener {
  53     /**
  54      * Invoked when a component has been added to the container.
  55      */
  56     public void componentAdded(ContainerEvent e) {}
  57 
  58     /**
  59      * Invoked when a component has been removed from the container.
  60      */
  61     public void componentRemoved(ContainerEvent e) {}
  62 }


  27 
  28 /**
  29  * An abstract adapter class for receiving container events.
  30  * The methods in this class are empty. This class exists as
  31  * convenience for creating listener objects.
  32  * <P>
  33  * Extend this class to create a <code>ContainerEvent</code> listener
  34  * and override the methods for the events of interest. (If you implement the
  35  * <code>ContainerListener</code> interface, you have to define all of
  36  * the methods in it. This abstract class defines null methods for them
  37  * all, so you can only have to define methods for events you care about.)
  38  * <P>
  39  * Create a listener object using the extended class and then register it with
  40  * a component using the component's <code>addContainerListener</code>
  41  * method. When the container's contents change because a component has
  42  * been added or removed, the relevant method in the listener object is invoked,
  43  * and the <code>ContainerEvent</code> is passed to it.
  44  *
  45  * @see ContainerEvent
  46  * @see ContainerListener
  47  * @see <a href="http://docs.oracle.com/javase/tutorial/uiswing/events/containerlistener.html">Tutorial: Writing a Container Listener</a>
  48  *
  49  * @author Amy Fowler
  50  * @since 1.1
  51  */
  52 public abstract class ContainerAdapter implements ContainerListener {
  53     /**
  54      * Invoked when a component has been added to the container.
  55      */
  56     public void componentAdded(ContainerEvent e) {}
  57 
  58     /**
  59      * Invoked when a component has been removed from the container.
  60      */
  61     public void componentRemoved(ContainerEvent e) {}
  62 }