public abstract class ContainerAdapter extends Object implements ContainerListener
扩展这个类来创建一个ContainerEvent
听众和覆盖感兴趣的事件的方法。(如果你实施ContainerListener
接口,你必须定义所有的方法在这。这个抽象类定义了他们所有的空方法,所以你只能定义你关心的事件的方法。)
创建一个使用扩展类的听众对象然后登记与组件使用组件的addContainerListener
方法。当容器的内容变化,因为组件被添加或删除,在监听对象相关的方法被调用时,与ContainerEvent
传递给它。
ContainerEvent
,
ContainerListener
,
Tutorial: Writing a Container Listener
Constructor and Description |
---|
ContainerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
componentAdded(ContainerEvent e)
当一个组件被添加到容器中时调用。
|
void |
componentRemoved(ContainerEvent e)
当组件已从容器中删除时调用。
|
public void componentAdded(ContainerEvent e)
componentAdded
接口
ContainerListener
public void componentRemoved(ContainerEvent e)
componentRemoved
接口
ContainerListener
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.