java.awt.event.WindowEvent#WINDOW_LOST_FOCUS源码实例Demo

下面列出了java.awt.event.WindowEvent#WINDOW_LOST_FOCUS 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bytecoder   文件: Window.java
boolean eventEnabled(AWTEvent e) {
    switch(e.id) {
      case WindowEvent.WINDOW_OPENED:
      case WindowEvent.WINDOW_CLOSING:
      case WindowEvent.WINDOW_CLOSED:
      case WindowEvent.WINDOW_ICONIFIED:
      case WindowEvent.WINDOW_DEICONIFIED:
      case WindowEvent.WINDOW_ACTIVATED:
      case WindowEvent.WINDOW_DEACTIVATED:
        if ((eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0 ||
            windowListener != null) {
            return true;
        }
        return false;
      case WindowEvent.WINDOW_GAINED_FOCUS:
      case WindowEvent.WINDOW_LOST_FOCUS:
        if ((eventMask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0 ||
            windowFocusListener != null) {
            return true;
        }
        return false;
      case WindowEvent.WINDOW_STATE_CHANGED:
        if ((eventMask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0 ||
            windowStateListener != null) {
            return true;
        }
        return false;
      default:
        break;
    }
    return super.eventEnabled(e);
}
 
源代码2 项目: jdk8u_jdk   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码3 项目: Bytecoder   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码4 项目: TencentKona-8   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码5 项目: hottub   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码6 项目: jdk8u-jdk   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码7 项目: jdk8u-dev-jdk   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码9 项目: openjdk-jdk8u   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码10 项目: jdk8u-jdk   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码11 项目: openjdk-8   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码12 项目: openjdk-jdk9   文件: SunToolkit.java
public static void postEvent(AppContext appContext, AWTEvent event) {
    if (event == null) {
        throw new NullPointerException();
    }

    AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
    if (sea != null && sea.isSequencedEvent(event)) {
        AWTEvent nested = sea.getNested(event);
        if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
            nested instanceof TimedWindowEvent)
        {
            TimedWindowEvent twe = (TimedWindowEvent)nested;
            ((SunToolkit)Toolkit.getDefaultToolkit()).
                setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
        }
    }

    // All events posted via this method are system-generated.
    // Placing the following call here reduces considerably the
    // number of places throughout the toolkit that would
    // otherwise have to be modified to precisely identify
    // system-generated events.
    setSystemGenerated(event);
    AppContext eventContext = targetToAppContext(event.getSource());
    if (eventContext != null && !eventContext.equals(appContext)) {
        throw new RuntimeException("Event posted on wrong app context : " + event);
    }
    PostEventQueue postEventQueue =
        (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
    if (postEventQueue != null) {
        postEventQueue.postEvent(event);
    }
}
 
源代码13 项目: openjdk-jdk8u-backup   文件: XWindowPeer.java
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    /* wrap in Sequenced, then post*/
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
源代码14 项目: dragonwell8_jdk   文件: XComponentPeer.java
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}
 
源代码15 项目: dragonwell8_jdk   文件: XWindowPeer.java
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    sendEvent(we);
}
 
源代码16 项目: jdk8u_jdk   文件: XWindowPeer.java
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    sendEvent(we);
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: XWindowPeer.java
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    sendEvent(we);
}
 
源代码18 项目: jdk8u-jdk   文件: XWindowPeer.java
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    sendEvent(we);
}
 
源代码19 项目: openjdk-8-source   文件: XWindowPeer.java
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
    sendEvent(we);
}
 
源代码20 项目: openjdk-jdk8u   文件: XComponentPeer.java
public void handleEvent(java.awt.AWTEvent e) {
    if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
        if (e instanceof MouseEvent) {
            if (e instanceof MouseWheelEvent) {
                handleJavaMouseWheelEvent((MouseWheelEvent) e);
            }
            else
                handleJavaMouseEvent((MouseEvent) e);
        }
        else if (e instanceof KeyEvent) {
            handleF10JavaKeyEvent((KeyEvent)e);
            handleJavaKeyEvent((KeyEvent)e);
        }
    }
    else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
        // even if target is disabled.
        handleF10JavaKeyEvent((KeyEvent)e);
    }
    else if (e instanceof InputMethodEvent) {
        handleJavaInputMethodEvent((InputMethodEvent) e);
    }

    int id = e.getID();

    switch(id) {
      case PaintEvent.PAINT:
          // Got native painting
          paintPending = false;
          // Fallthrough to next statement
      case PaintEvent.UPDATE:
          // Skip all painting while layouting and all UPDATEs
          // while waiting for native paint
          if (!isLayouting && !paintPending) {
              paintArea.paint(target,false);
          }
          return;
      case FocusEvent.FOCUS_LOST:
      case FocusEvent.FOCUS_GAINED:
          handleJavaFocusEvent(e);
          break;
      case WindowEvent.WINDOW_LOST_FOCUS:
      case WindowEvent.WINDOW_GAINED_FOCUS:
          handleJavaWindowFocusEvent(e);
          break;
      default:
          break;
    }

}