A container fires a container event whenever a component is added or removed.
// Create a listen for container events
ContainerListener listener = new ContainerAdapter() {
public void componentAdded(ContainerEvent evt) {
// Get component that was added
Component c = evt.getChild();
}
public void componentRemoved(ContainerEvent evt) {
// Get component that was removed
Component c = evt.getChild();
}
};
// Register the listener with the container
container.addContainerListener(listener);
|
e573. Determining When a Component Is Added or Removed from a Container
最新推荐文章于 2023-12-11 20:14:33 发布
3441

被折叠的 条评论
为什么被折叠?



