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


Java ContainerListener类代码示例

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


ContainerListener类属于java.awt.event包,在下文中一共展示了ContainerListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readObject

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * Deserialize this Container:
 * <ol>
 * <li>Read from the stream the default serializable fields.</li>
 * <li>Read a list of serializable ContainerListeners as optional
 * data.  If the list is null, no listeners will be registered.</li>
 * <li>Read this Container's FocusTraversalPolicy as optional data.
 * If this is null, then this Container will use a
 * DefaultFocusTraversalPolicy.</li>
 * </ol>
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject (ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject ();
  String key = (String) s.readObject ();
  while (key != null)
    {
      Object object = s.readObject ();
      if ("containerL".equals (key))
        addContainerListener((ContainerListener) object);
      // FIXME: under what key is the focus traversal policy stored?
      else if ("focusTraversalPolicy".equals (key))
        setFocusTraversalPolicy ((FocusTraversalPolicy) object);

      key = (String) s.readObject();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:33,代码来源:Container.java

示例2: 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

示例3: addContainerListener

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * Maps {@code Container.addContainerListener(ContainerListener)}
 * through queue
 */
public void addContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("addContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).addContainerListener(containerListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:ContainerOperator.java

示例4: removeContainerListener

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * Maps {@code Container.removeContainerListener(ContainerListener)}
 * through queue
 */
public void removeContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("removeContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).removeContainerListener(containerListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:ContainerOperator.java

示例5: addContainerListener

import java.awt.event.ContainerListener; //导入依赖的package包/类
public synchronized void addContainerListener(final ContainerListener l) {
    if (l == null) {
        return;
    }
    
    list.add(ContainerListener.class, l);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:8,代码来源:Container.java

示例6: remove

import java.awt.event.ContainerListener; //导入依赖的package包/类
public synchronized void remove(final Component comp) {
	if(components == null){
		return;
	}
	
	final int index = components.indexOf(comp);
	if (index >= 0) {
		components.remove(index);
		comp.parent = null;
		
		final ViewGroup layoutView = (ViewGroup)getContainerViewAdAPI();
		final View subView = comp.getPeerAdAPI();
		if(layoutView != null && subView != null){
			ActivityManager.getActivity().runOnUiThread(new Runnable() {
				@Override
				public void run() {
					layoutView.removeView(subView);
				}
			});
		}
		
		{
			final ContainerEvent event = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, comp);
			final ContainerListener[] listener = list.getListeners(ContainerListener.class);
			for (int i = 0; i < listener.length; i++) {
				listener[i].componentRemoved(event);
			}
		}
	}
	
	if (layout != null) {
		layout.removeLayoutComponent(comp);
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:35,代码来源:Container.java

示例7: addContainerListener

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * Adds the specified container listener to this object's list of
 * container listeners.
 *
 * @param listener The listener to add.
 */
public synchronized void addContainerListener(ContainerListener listener)
{
  if (listener != null)
    {
      containerListener = AWTEventMulticaster.add(containerListener,
                                                  listener);
      newEventsOnly = true;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:Container.java

示例8: getContainerListeners

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * @since 1.4
 */
public synchronized ContainerListener[] getContainerListeners()
{
  return (ContainerListener[])
    AWTEventMulticaster.getListeners(containerListener,
                                     ContainerListener.class);
}
 
开发者ID:vilie,项目名称:javify,代码行数:10,代码来源:Container.java

示例9: componentAdded

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * This method is called when a component is added to the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:StandaloneAppletWindow.java

示例10: componentRemoved

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * This method is called when a component is removed from the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:StandaloneAppletWindow.java

示例11: isAddedTo

import java.awt.event.ContainerListener; //导入依赖的package包/类
private boolean isAddedTo(Container container) {
  for (ContainerListener listener : container.getContainerListeners()) {
    if (listener == this) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MnemonicContainerListener.java

示例12: componentAdded

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * This method is called when a component is added to the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:16,代码来源:StandaloneAppletWindow.java

示例13: componentRemoved

import java.awt.event.ContainerListener; //导入依赖的package包/类
/**
 * This method is called when a component is removed from the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:15,代码来源:StandaloneAppletWindow.java

示例14: componentAdded

import java.awt.event.ContainerListener; //导入依赖的package包/类
public void componentAdded(ContainerEvent e) {
    if ((a != null) && (a instanceof ContainerListener)) {
        ((ContainerListener) a).componentAdded(e);
    }
    if ((b != null) && (b instanceof ContainerListener)) {
        ((ContainerListener) b).componentAdded(e);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:AWTEventMulticaster.java

示例15: componentRemoved

import java.awt.event.ContainerListener; //导入依赖的package包/类
public void componentRemoved(ContainerEvent e) {
    if ((a != null) && (a instanceof ContainerListener)) {
        ((ContainerListener) a).componentRemoved(e);
    }
    if ((b != null) && (b instanceof ContainerListener)) {
        ((ContainerListener) b).componentRemoved(e);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:AWTEventMulticaster.java


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