| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.util.EventObject
java.awt.AWTEvent
java.awt.event.ComponentEvent
java.awt.event.ContainerEvent
public class ContainerEvent
指示容器内容因为添加或移除组件而更改的低级别事件。
这些容器事件“仅”为通知目的而提供;AWT 将自动处理内部容器内容的更改,使程序正常工作,而不管该程序是否接收这些事件。
在向容器对象(比如 Panel)添加组件或从中移除组件时,容器对象将生成此低级别事件。事件被传递给每一个 ContainerListener 或 ContainerAdapter 对象,这些对象使用组件的 addContainerListener 方法注册,以接收这类事件。(ContainerAdapter 对象实现 ContainerListener 接口。)当发生该事件时,所有这类侦听器对象都获得此 ContainerEvent。
ContainerAdapter, 
ContainerListener, 
Tutorial: Writing a Container Listener, 
序列化表格| 字段摘要 | |
|---|---|
| static int | COMPONENT_ADDED此事件指示组件已被添加到容器中。 | 
| static int | COMPONENT_REMOVED此事件指示已从容器中移除组件。 | 
| static int | CONTAINER_FIRST用于容器事件的 id 范围的起始编号。 | 
| static int | CONTAINER_LAST用于容器事件的 id 范围的结束编号。 | 
| 从类 java.awt.event.ComponentEvent 继承的字段 | 
|---|
| COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN | 
| 从类 java.util.EventObject 继承的字段 | 
|---|
| source | 
| 构造方法摘要 | |
|---|---|
| ContainerEvent(Component source,
               int id,
               Component child)构造一个 ContainerEvent对象。 | |
| 方法摘要 | |
|---|---|
|  Component | getChild()返回受事件影响的组件。 | 
|  Container | getContainer()返回事件的始发者。 | 
|  String | paramString()返回标识此事件的参数字符串。 | 
| 从类 java.awt.event.ComponentEvent 继承的方法 | 
|---|
| getComponent | 
| 从类 java.awt.AWTEvent 继承的方法 | 
|---|
| consume, getID, isConsumed, setSource, toString | 
| 从类 java.util.EventObject 继承的方法 | 
|---|
| getSource | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| 字段详细信息 | 
|---|
public static final int CONTAINER_FIRST
public static final int CONTAINER_LAST
public static final int COMPONENT_ADDED
public static final int COMPONENT_REMOVED
| 构造方法详细信息 | 
|---|
public ContainerEvent(Component source,
                      int id,
                      Component child)
ContainerEvent 对象。
注意,传入无效 id 会导致未指定的行为。如果 source 为 null,则此方法抛出 IllegalArgumentException。
source - 发起事件的 Component 对象(容器)id - 指示事件类型的整数child - 被添加或移除的组件
IllegalArgumentException - 如果 source 为 null| 方法详细信息 | 
|---|
public Container getContainer()
Container 对象,如果该对象不是一个 Container,则返回 null。public Component getChild()
public String paramString()
ComponentEvent 中的 paramString| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。