当前位置: 首页>>代码示例>>Java>>正文


Java ContainerListener.componentAdded方法代码示例

本文整理汇总了Java中java.awt.event.ContainerListener.componentAdded方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerListener.componentAdded方法的具体用法?Java ContainerListener.componentAdded怎么用?Java ContainerListener.componentAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.ContainerListener的用法示例。


在下文中一共展示了ContainerListener.componentAdded方法的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();
    // }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:Container.java

示例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());
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:11,代码来源:BasicToolBarUITest.java

示例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;
        }
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:32,代码来源:Container.java


注:本文中的java.awt.event.ContainerListener.componentAdded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。