JavaTM 2 Platform
Standard Ed. 6

java.awt.event
类 ContainerAdapter

java.lang.Object
  继承者 java.awt.event.ContainerAdapter
所有已实现的接口:
ContainerListener, EventListener

public abstract class ContainerAdapter
extends Object
implements ContainerListener

用于接收容器事件的抽象适配器类。此类中的方法为空。此类存在的目的只是为了便于创建侦听器对象。

扩展此类可创建 ContainerEvent 侦听器并针对感兴趣的事件重写方法。(如果实现 ContainerListener 接口,则必须定义该接口中的所有方法。此抽象类将所有这些方法都定义为 null,所以您只需针对所关心的事件重写方法。)

使用扩展的类创建一个侦听器对象,然后使用组件的 addContainerListener 方法向组件注册。当容器的内容因为添加和移除组件而更改时,可调用侦听器对象中的相关方法,并将 ContainerEvent 传递给它。

从以下版本开始:
1.1
另请参见:
ContainerEvent, ContainerListener, Tutorial: Writing a Container Listener

构造方法摘要
ContainerAdapter()
           
 
方法摘要
 void componentAdded(ContainerEvent e)
          已将组件添加到容器中时调用。
 void componentRemoved(ContainerEvent e)
          已从容器中移除组件时调用。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ContainerAdapter

public ContainerAdapter()
方法详细信息

componentAdded

public void componentAdded(ContainerEvent e)
已将组件添加到容器中时调用。

指定者:
接口 ContainerListener 中的 componentAdded

componentRemoved

public void componentRemoved(ContainerEvent e)
已从容器中移除组件时调用。

指定者:
接口 ContainerListener 中的 componentRemoved

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策