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


Java WindowEvent.WINDOW_LOST_FOCUS属性代码示例

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


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

示例1: postEvent

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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:SunToolkit.java

示例2: handleWindowFocusOut

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));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:XWindowPeer.java

示例3: handleEvent

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;
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:XComponentPeer.java

示例4: handleWindowFocusOutSync

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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:XWindowPeer.java

示例5: handleEvent

@SuppressWarnings("fallthrough")
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;
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:XComponentPeer.java


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