| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.event.ContainerAdapter
public abstract class ContainerAdapter
用于接收容器事件的抽象适配器类。此类中的方法为空。此类存在的目的只是为了便于创建侦听器对象。
扩展此类可创建 ContainerEvent 侦听器并针对感兴趣的事件重写方法。(如果实现 ContainerListener 接口,则必须定义该接口中的所有方法。此抽象类将所有这些方法都定义为 null,所以您只需针对所关心的事件重写方法。)
 
使用扩展的类创建一个侦听器对象,然后使用组件的 addContainerListener 方法向组件注册。当容器的内容因为添加和移除组件而更改时,可调用侦听器对象中的相关方法,并将 ContainerEvent 传递给它。
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 | 
| 构造方法详细信息 | 
|---|
public ContainerAdapter()
| 方法详细信息 | 
|---|
public void componentAdded(ContainerEvent e)
ContainerListener 中的 componentAddedpublic void componentRemoved(ContainerEvent e)
ContainerListener 中的 componentRemoved| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。