本文整理汇总了Java中java.awt.event.ContainerListener.componentRemoved方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerListener.componentRemoved方法的具体用法?Java ContainerListener.componentRemoved怎么用?Java ContainerListener.componentRemoved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.ContainerListener
的用法示例。
在下文中一共展示了ContainerListener.componentRemoved方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processContainerEvent
import java.awt.event.ContainerListener; //导入方法依赖的package包/类
protected void processContainerEvent(ContainerEvent e) {
// toolkit.lockAWT();
// try {
for (Iterator<?> i = containerListeners.getUserIterator(); i.hasNext();) {
ContainerListener listener = (ContainerListener) i.next();
switch (e.getID()) {
case ContainerEvent.COMPONENT_ADDED:
listener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
listener.componentRemoved(e);
break;
}
}
// } finally {
// toolkit.unlockAWT();
// }
}
示例2: testToolBarContListener
import java.awt.event.ContainerListener; //导入方法依赖的package包/类
public void testToolBarContListener() {
ContainerListener l = ui.createToolBarContListener();
Border border = b.getBorder();
ContainerEvent e = new ContainerEvent(toolBar, ContainerEvent.COMPONENT_ADDED, b);
l.componentAdded(e);
assertNotSame(border, b.getBorder());
e = new ContainerEvent(toolBar, ContainerEvent.COMPONENT_REMOVED, b);
l.componentRemoved(e);
assertSame(border, b.getBorder());
}
示例3: processContainerEvent
import java.awt.event.ContainerListener; //导入方法依赖的package包/类
/**
* Processes container events occurring on this container by
* dispatching them to any registered ContainerListener objects.
* NOTE: This method will not be called unless container events
* are enabled for this component; this happens when one of the
* following occurs:
* <ul>
* <li>A ContainerListener object is registered via
* <code>addContainerListener</code>
* <li>Container events are enabled via <code>enableEvents</code>
* </ul>
* <p>Note that if the event parameter is <code>null</code>
* the behavior is unspecified and may result in an
* exception.
*
* @param e the container event
* @see Component#enableEvents
*/
protected void processContainerEvent(ContainerEvent e) {
ContainerListener listener = containerListener;
if (listener != null) {
switch(e.getID()) {
case ContainerEvent.COMPONENT_ADDED:
listener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
listener.componentRemoved(e);
break;
}
}
}