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


Java WindowFocusListener类代码示例

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


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

示例1: AgentInterface

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
/**
 * Create the frame.
 * @param center Whether the frame should be centered on the monitor
 * @param agentName The identifier of the Agent instance
 * @param seats The seats in the environment
 */
public AgentInterface(Boolean center, String agentName, ArrayList<Seat> seats) {
	name = agentName;
	allSeats = seats;
	initializeGUI(center, agentName);

	addWindowFocusListener(new WindowFocusListener() {	// NB we need a WindowFocusListener not just a FocusListener
		public void windowGainedFocus(WindowEvent e) {	// When focus is gained the GUI is updated because the other thread could have done something while in control.
			displaySelectedSeatStatus();	// Used to update seat status text box
			updateSeatPanelColors();
			updateReserveAvailability();
		}

		@Override
		public void windowLostFocus(WindowEvent arg0) {
			// Must be implemented
		}
	});
}
 
开发者ID:hb20007,项目名称:java-programs,代码行数:25,代码来源:AgentInterface.java

示例2: processWindowFocusEvent

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
protected void processWindowFocusEvent(WindowEvent e) {
	try{
	WindowFocusListener[] wl = getWindowFocusListeners();
	if(wl == null){
		return;
	}
       switch (e.getID()) {
           case WindowEvent.WINDOW_GAINED_FOCUS:
           	DebugLogger.log("fire WindowListener.windowGainedFocus.");
			for (int i = 0; i < wl.length; i++) {
				wl[i].windowGainedFocus(e);
			}
               break;
           case WindowEvent.WINDOW_LOST_FOCUS:
           	DebugLogger.log("fire WindowListener.windowLostFocus.");
			for (int i = 0; i < wl.length; i++) {
				wl[i].windowLostFocus(e);
			}
               break;
           default:
               break;
       }
	}catch (Throwable ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:27,代码来源:Window.java

示例3: wireComponent

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
@Override
protected void wireComponent(final ComponentContext context) {

	super.wireComponent(context);

	final Window window = (Window) context.getComponent();

	final MethodListenerProxy<WindowListener> windowListenerProxy = new MethodListenerProxy<WindowListener>(
			WindowListener.class, context.getActionListeners());

	final MethodListenerProxy<WindowFocusListener> windowFocusListenerProxy = new MethodListenerProxy<WindowFocusListener>(
			WindowFocusListener.class, context.getActionListeners());

	if (windowListenerProxy.hasListeningMethod()) {
		window.addWindowListener(windowListenerProxy.getProxy());
		LOGGER.debug("{}|Window.addWindowListener", context.getId());
	}

	if (windowFocusListenerProxy.hasListeningMethod()) {
		window.addWindowFocusListener(windowFocusListenerProxy.getProxy());
		LOGGER.debug("{}|Window.addWindowFocusListener", context.getId());
	}
}
 
开发者ID:kennycyb,项目名称:java-ui-factory,代码行数:24,代码来源:WindowFactory.java

示例4: getWindowFocusListeners

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
/**
 * Returns an array of all the window focus listeners registered on this
 * window.
 *
 * @since 1.4
 */
public synchronized WindowFocusListener[] getWindowFocusListeners()
{
  return (WindowFocusListener[])
    AWTEventMulticaster.getListeners(windowFocusListener,
                                     WindowFocusListener.class);
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:Window.java

示例5: addWindowFocusListener

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
/**
 * Adds the specified listener to this window.
 */
public void addWindowFocusListener (WindowFocusListener wfl)
{
  if (wfl != null)
    {
      newEventsOnly = true;
      windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
                                                     wfl);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:Window.java

示例6: windowGainedFocus

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

示例7: windowLostFocus

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

示例8: getListeners

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (WindowFocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowFocusListeners();
    } else if (WindowStateListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowStateListeners();
    } else if (WindowListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getWindowListeners();
    } else {
        return super.getListeners(listenerType);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:Window.java

示例9: processWindowFocusEvent

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
protected void processWindowFocusEvent(WindowEvent e) {
    for (Iterator<?> i = windowFocusListeners.getUserIterator(); i.hasNext();) {
        WindowFocusListener listener = (WindowFocusListener) i.next();
        switch (e.getID()) {
            case WindowEvent.WINDOW_GAINED_FOCUS:
                listener.windowGainedFocus(e);
                break;
            case WindowEvent.WINDOW_LOST_FOCUS:
                listener.windowLostFocus(e);
                break;
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:Window.java

示例10: addWindowFocusListener

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

示例11: removeWindowFocusListener

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

示例12: getWindowFocusListeners

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
public synchronized WindowFocusListener[] getWindowFocusListeners() {
	return getListeners(WindowFocusListener.class);
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:Window.java

示例13: removeWindowFocusListener

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
/**
 * Removes the specified listener from this window.
 */
public void removeWindowFocusListener (WindowFocusListener wfl)
{
  windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:Window.java

示例14: add

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
public static WindowFocusListener add(WindowFocusListener a, WindowFocusListener b) {
    return (WindowFocusListener) addInternal(a, b);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:AWTEventMulticaster.java

示例15: remove

import java.awt.event.WindowFocusListener; //导入依赖的package包/类
public static WindowFocusListener remove(WindowFocusListener l, WindowFocusListener oldl) {
    return (WindowFocusListener) removeInternal(l, oldl);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:AWTEventMulticaster.java


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