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


Java WindowEvent.WINDOW_GAINED_FOCUS属性代码示例

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


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

示例1: trackEvent

private static boolean trackEvent(int eventID, Component comp, Runnable action, int time, boolean printEvent) {
    EventListener listener = null;

    switch (eventID) {
    case WindowEvent.WINDOW_GAINED_FOCUS:
        listener = wgfListener;
        break;
    case FocusEvent.FOCUS_GAINED:
        listener = fgListener;
        break;
    case ActionEvent.ACTION_PERFORMED:
        listener = apListener;
        break;
    }

    listener.listen(comp, printEvent);
    action.run();
    return Util.waitForCondition(listener.getNotifier(), time);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:Util.java

示例2: handleWmTakeFocus

private void handleWmTakeFocus(XClientMessageEvent cl) {
    if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
        focusLog.fine("WM_TAKE_FOCUS on {0}", this);
    }

    if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
        // JDK-8159460
        Window focusedWindow = XKeyboardFocusManagerPeer.getInstance()
                .getCurrentFocusedWindow();
        Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
        if (activeWindow != target) {
            requestWindowFocus(cl.get_data(1), true);
        } else {
            WindowEvent we = new WindowEvent(focusedWindow,
                    WindowEvent.WINDOW_GAINED_FOCUS);
            sendEvent(we);
        }
    } else {
        requestWindowFocus(cl.get_data(1), true);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:XDecoratedPeer.java

示例3: handleWindowFocusIn_Dispatch

public void handleWindowFocusIn_Dispatch() {
    if (EventQueue.isDispatchThread()) {
        XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
        WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
        SunToolkit.setSystemGenerated(we);
        target.dispatchEvent(we);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:XWindowPeer.java

示例4: 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

示例5: handleWindowFocusInSync

public void handleWindowFocusInSync(long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
    sendEvent(we);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:XWindowPeer.java

示例6: handleWindowFocusIn

public void handleWindowFocusIn(long serial) {
    WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
    /* wrap in Sequenced, then post*/
    XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
    postEvent(wrapInSequenced((AWTEvent) we));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:XWindowPeer.java

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