當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。