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


Java CausedFocusEvent.Cause方法代码示例

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


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

示例1: addLightweightRequest

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
boolean addLightweightRequest(Component descendant,
                              boolean temporary, CausedFocusEvent.Cause cause) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
            log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
        }
        if (descendant == null) {
            log.fine("Assertion (descendant != null) failed");
        }
    }

    Component lastDescendant = ((lightweightRequests.size() > 0)
        ? lightweightRequests.getLast().component
        : null);

    if (descendant != lastDescendant) {
        // Not a duplicate request
        lightweightRequests.add
            (new LightweightFocusRequest(descendant, temporary, cause));
        return true;
    } else {
        return false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:KeyboardFocusManager.java

示例2: requestWindowFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
@Override
public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
    if (!focusAllowedFor()) {
        return false;
    }
    if (getPlatformWindow().rejectFocusRequest(cause)) {
        return false;
    }

    Window opposite = LWKeyboardFocusManagerPeer.getInstance().
        getCurrentFocusedWindow();

    changeFocusedWindow(true, opposite);

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:LWLightweightFramePeer.java

示例3: deliverFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
public static boolean deliverFocus(Component lightweightChild,
                                   Component target,
                                   boolean temporary,
                                   boolean focusedWindowChangeAllowed,
                                   long time,
                                   CausedFocusEvent.Cause cause)
{
    // TODO: do something to eliminate this forwarding
    return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
                                                     target,
                                                     temporary,
                                                     focusedWindowChangeAllowed,
                                                     time,
                                                     cause,
                                                     getNativeFocusOwner());
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:17,代码来源:WKeyboardFocusManagerPeer.java

示例4: isRequestFocusAccepted

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
private boolean isRequestFocusAccepted(boolean temporary,
                                       boolean focusedWindowChangeAllowed,
                                       CausedFocusEvent.Cause cause)
{
    if (!isFocusable() || !isVisible()) {
        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
            focusLog.finest("Not focusable or not visible");
        }
        return false;
    }

    ComponentPeer peer = this.peer;
    if (peer == null) {
        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
            focusLog.finest("peer is null");
        }
        return false;
    }

    Window window = getContainingWindow();
    if (window == null || !((Window)window).isFocusableWindow()) {
        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
            focusLog.finest("Component doesn't have toplevel");
        }
        return false;
    }

    // We have passed all regular checks for focus request,
    // now let's call RequestFocusController and see what it says.
    Component focusOwner = KeyboardFocusManager.getMostRecentFocusOwner(window);
    if (focusOwner == null) {
        // sometimes most recent focus owner may be null, but focus owner is not
        // e.g. we reset most recent focus owner if user removes focus owner
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        if (focusOwner != null && focusOwner.getContainingWindow() != window) {
            focusOwner = null;
        }
    }

    if (focusOwner == this || focusOwner == null) {
        // Controller is supposed to verify focus transfers and for this it
        // should know both from and to components.  And it shouldn't verify
        // transfers from when these components are equal.
        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
            focusLog.finest("focus owner is null or this");
        }
        return true;
    }

    if (CausedFocusEvent.Cause.ACTIVATION == cause) {
        // we shouldn't call RequestFocusController in case we are
        // in activation.  We do request focus on component which
        // has got temporary focus lost and then on component which is
        // most recent focus owner.  But most recent focus owner can be
        // changed by requestFocsuXXX() call only, so this transfer has
        // been already approved.
        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
            focusLog.finest("cause is activation");
        }
        return true;
    }

    boolean ret = Component.requestFocusController.acceptRequestFocus(focusOwner,
                                                                      this,
                                                                      temporary,
                                                                      focusedWindowChangeAllowed,
                                                                      cause);
    if (focusLog.isLoggable(PlatformLogger.FINEST)) {
        focusLog.finest("RequestFocusController returns {0}", ret);
    }

    return ret;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:74,代码来源:Component.java

示例5: shouldNativelyFocusHeavyweight

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
public int shouldNativelyFocusHeavyweight(Component heavyweight,
                                   Component descendant,
                                   boolean temporary,
                                   boolean focusedWindowChangeAllowed,
                                   long time,
                                   CausedFocusEvent.Cause cause)
{
    return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
        heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:KeyboardFocusManager.java

示例6:

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
@Override
public boolean requestFocus
     (Component lightweightChild, boolean temporary,
      boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
{
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:WFileDialogPeer.java

示例7: rejectFocusRequest

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
@Override
public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
    // Cross-app activation requests are not allowed.
    if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
        !target.isParentWindowActive())
    {
        focusLogger.fine("the embedder is inactive, so the request is rejected");
        return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:CPlatformEmbeddedFrame.java

示例8: deliverFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
public static boolean deliverFocus(Component lightweightChild,
                                   Component target,
                                   boolean temporary,
                                   boolean focusedWindowChangeAllowed,
                                   long time,
                                   CausedFocusEvent.Cause cause)
{
    return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
                                                     target,
                                                     temporary,
                                                     focusedWindowChangeAllowed,
                                                     time,
                                                     cause,
                                                     getInstance().getCurrentFocusOwner());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:XKeyboardFocusManagerPeer.java

示例9:

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
@Override
public boolean requestFocus
     (Component lightweightChild, boolean temporary,
      boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
{

    return false;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:9,代码来源:WPrintDialogPeer.java

示例10: LightweightFocusRequest

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
LightweightFocusRequest(Component component, boolean temporary, CausedFocusEvent.Cause cause) {
    this.component = component;
    this.temporary = temporary;
    this.cause = cause;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:KeyboardFocusManager.java

示例11: requestFocusInWindow

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
boolean requestFocusInWindow(CausedFocusEvent.Cause cause) {
    return requestFocusHelper(false, false, cause);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:Component.java

示例12: requestFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
public boolean requestFocus(Component comp, CausedFocusEvent.Cause cause) {
    return comp.requestFocus(cause);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:Component.java

示例13: requestFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
boolean requestFocus(boolean temporary, CausedFocusEvent.Cause cause) {
    return requestFocusHelper(temporary, true, cause);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:Component.java

示例14: isRequestFocusAccepted

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
private boolean isRequestFocusAccepted(boolean temporary,
                                       boolean focusedWindowChangeAllowed,
                                       CausedFocusEvent.Cause cause)
{
    if (!isFocusable() || !isVisible()) {
        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("Not focusable or not visible");
        }
        return false;
    }

    ComponentPeer peer = this.peer;
    if (peer == null) {
        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("peer is null");
        }
        return false;
    }

    Window window = getContainingWindow();
    if (window == null || !window.isFocusableWindow()) {
        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("Component doesn't have toplevel");
        }
        return false;
    }

    // We have passed all regular checks for focus request,
    // now let's call RequestFocusController and see what it says.
    Component focusOwner = KeyboardFocusManager.getMostRecentFocusOwner(window);
    if (focusOwner == null) {
        // sometimes most recent focus owner may be null, but focus owner is not
        // e.g. we reset most recent focus owner if user removes focus owner
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        if (focusOwner != null && focusOwner.getContainingWindow() != window) {
            focusOwner = null;
        }
    }

    if (focusOwner == this || focusOwner == null) {
        // Controller is supposed to verify focus transfers and for this it
        // should know both from and to components.  And it shouldn't verify
        // transfers from when these components are equal.
        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("focus owner is null or this");
        }
        return true;
    }

    if (CausedFocusEvent.Cause.ACTIVATION == cause) {
        // we shouldn't call RequestFocusController in case we are
        // in activation.  We do request focus on component which
        // has got temporary focus lost and then on component which is
        // most recent focus owner.  But most recent focus owner can be
        // changed by requestFocsuXXX() call only, so this transfer has
        // been already approved.
        if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
            focusLog.finest("cause is activation");
        }
        return true;
    }

    boolean ret = Component.requestFocusController.acceptRequestFocus(focusOwner,
                                                                      this,
                                                                      temporary,
                                                                      focusedWindowChangeAllowed,
                                                                      cause);
    if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
        focusLog.finest("RequestFocusController returns {0}", ret);
    }

    return ret;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:74,代码来源:Component.java

示例15: requestFocus

import sun.awt.CausedFocusEvent; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public boolean requestFocus(Component lightweightChild, boolean temporary,
                            boolean focusedWindowChangeAllowed, long time,
                            CausedFocusEvent.Cause cause)
{
    if (WKeyboardFocusManagerPeer.
        processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary,
                                              focusedWindowChangeAllowed, time))
    {
        return true;
    }

    int result = WKeyboardFocusManagerPeer
        .shouldNativelyFocusHeavyweight((Component)target, lightweightChild,
                                        temporary, focusedWindowChangeAllowed,
                                        time, cause);

    switch (result) {
      case WKeyboardFocusManagerPeer.SNFH_FAILURE:
          return false;
      case WKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
          if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
              focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target);
          }
          Window parentWindow = SunToolkit.getContainingWindow((Component)target);
          if (parentWindow == null) {
              return rejectFocusRequestHelper("WARNING: Parent window is null");
          }
          WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
          if (wpeer == null) {
              return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
          }
          boolean res = wpeer.requestWindowFocus(cause);

          if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
              focusLog.finer("Requested window focus: " + res);
          }
          // If parent window can be made focused and has been made focused(synchronously)
          // then we can proceed with children, otherwise we retreat.
          if (!(res && parentWindow.isFocused())) {
              return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
          }
          return WKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
                                                        (Component)target,
                                                        temporary,
                                                        focusedWindowChangeAllowed,
                                                        time, cause);

      case WKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
          // Either lightweight or excessive request - all events are generated.
          return true;
    }
    return false;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:56,代码来源:WComponentPeer.java


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