java类java.awt.event.WindowFocusListener的实例源码

AgentInterface.java 文件源码 项目:java-programs 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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
        }
    });
}
Window.java 文件源码 项目:j2se_for_android 阅读 29 收藏 0 点赞 0 评论 0
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();
    }
}
WindowFactory.java 文件源码 项目:java-ui-factory 阅读 23 收藏 0 点赞 0 评论 0
@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());
    }
}
Window.java 文件源码 项目:javify 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
}
Window.java 文件源码 项目:javify 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Adds the specified listener to this window.
 */
public void addWindowFocusListener (WindowFocusListener wfl)
{
  if (wfl != null)
    {
      newEventsOnly = true;
      windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
                                                     wfl);
    }
}
Window.java 文件源码 项目:jvm-stm 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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);
}
Window.java 文件源码 项目:jvm-stm 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Adds the specified listener to this window.
 */
public void addWindowFocusListener (WindowFocusListener wfl)
{
  if (wfl != null)
    {
      newEventsOnly = true;
      windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
                                                     wfl);
    }
}
AWTEventMulticaster.java 文件源码 项目:cn1 阅读 23 收藏 0 点赞 0 评论 0
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);
    }
}
AWTEventMulticaster.java 文件源码 项目:cn1 阅读 21 收藏 0 点赞 0 评论 0
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);
    }
}
Window.java 文件源码 项目:cn1 阅读 23 收藏 0 点赞 0 评论 0
@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);
    }
}
Window.java 文件源码 项目:cn1 阅读 22 收藏 0 点赞 0 评论 0
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;
        }
    }
}
Window.java 文件源码 项目:JamVM-PH 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
}
Window.java 文件源码 项目:JamVM-PH 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Adds the specified listener to this window.
 */
public void addWindowFocusListener (WindowFocusListener wfl)
{
  if (wfl != null)
    {
      newEventsOnly = true;
      windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
                                                     wfl);
    }
}
Window.java 文件源码 项目:classpath 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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);
}
Window.java 文件源码 项目:classpath 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Adds the specified listener to this window.
 */
public void addWindowFocusListener (WindowFocusListener wfl)
{
  if (wfl != null)
    {
      newEventsOnly = true;
      windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
                                                     wfl);
    }
}
AWTEventMulticaster.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
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);
    }
}
AWTEventMulticaster.java 文件源码 项目:freeVM 阅读 21 收藏 0 点赞 0 评论 0
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);
    }
}
Window.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
@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);
    }
}
Window.java 文件源码 项目:freeVM 阅读 25 收藏 0 点赞 0 评论 0
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;
        }
    }
}
AWTEventMulticaster.java 文件源码 项目:freeVM 阅读 21 收藏 0 点赞 0 评论 0
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);
    }
}
AWTEventMulticaster.java 文件源码 项目:freeVM 阅读 24 收藏 0 点赞 0 评论 0
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);
    }
}
Window.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
@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);
    }
}
Window.java 文件源码 项目:freeVM 阅读 24 收藏 0 点赞 0 评论 0
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;
        }
    }
}
Window.java 文件源码 项目:j2se_for_android 阅读 20 收藏 0 点赞 0 评论 0
public synchronized void addWindowFocusListener(WindowFocusListener l) {
    if (l == null) {
        return;
    }
    list.add(WindowFocusListener.class, l);
}
Window.java 文件源码 项目:j2se_for_android 阅读 27 收藏 0 点赞 0 评论 0
public synchronized void removeWindowFocusListener(WindowFocusListener l) {
    if (l == null) {
        return;
    }
    list.remove(WindowFocusListener.class, l);
}
Window.java 文件源码 项目:j2se_for_android 阅读 20 收藏 0 点赞 0 评论 0
public synchronized WindowFocusListener[] getWindowFocusListeners() {
    return getListeners(WindowFocusListener.class);
}
Window.java 文件源码 项目:javify 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Removes the specified listener from this window.
 */
public void removeWindowFocusListener (WindowFocusListener wfl)
{
  windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
}
Window.java 文件源码 项目:jvm-stm 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Removes the specified listener from this window.
 */
public void removeWindowFocusListener (WindowFocusListener wfl)
{
  windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
}
AWTEventMulticaster.java 文件源码 项目:cn1 阅读 22 收藏 0 点赞 0 评论 0
public static WindowFocusListener add(WindowFocusListener a, WindowFocusListener b) {
    return (WindowFocusListener) addInternal(a, b);
}
AWTEventMulticaster.java 文件源码 项目:cn1 阅读 21 收藏 0 点赞 0 评论 0
public static WindowFocusListener remove(WindowFocusListener l, WindowFocusListener oldl) {
    return (WindowFocusListener) removeInternal(l, oldl);
}


问题


面经


文章

微信
公众号

扫码关注公众号