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


Java CausedFocusEvent类代码示例

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


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

示例1: retargetUnexpectedFocusEvent

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
static FocusEvent retargetUnexpectedFocusEvent(FocusEvent fe) {
    synchronized (heavyweightRequests) {
        // Any other case represents a failure condition which we did
        // not expect. We need to clearFocusRequestList() and patch up
        // the event as best as possible.

        if (removeFirstRequest()) {
            return (FocusEvent)retargetFocusEvent(fe);
        }

        Component source = fe.getComponent();
        Component opposite = fe.getOppositeComponent();
        boolean temporary = false;
        if (fe.getID() == FocusEvent.FOCUS_LOST &&
            (opposite == null || isTemporary(opposite, source)))
        {
            temporary = true;
        }
        return new CausedFocusEvent(source, fe.getID(), temporary, opposite,
                                    CausedFocusEvent.Cause.NATIVE_SYSTEM);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:KeyboardFocusManager.java

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

示例3: transferFocus

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
boolean transferFocus(boolean clearOnFailure) {
    if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
        focusLog.finer("clearOnFailure = " + clearOnFailure);
    }
    Component toFocus = getNextFocusCandidate();
    boolean res = false;
    if (toFocus != null && !toFocus.isFocusOwner() && toFocus != this) {
        res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_FORWARD);
    }
    if (clearOnFailure && !res) {
        if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
            focusLog.finer("clear global focus owner");
        }
        KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv();
    }
    if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
        focusLog.finer("returning result: " + res);
    }
    return res;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Component.java

示例4: doRestoreFocus

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
private boolean doRestoreFocus(Component toFocus, Component vetoedComponent,
                               boolean clearOnFailure)
{
    if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.canBeFocusOwner() &&
        toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK))
    {
        return true;
    } else {
        Component nextFocus = toFocus.getNextFocusCandidate();
        if (nextFocus != null && nextFocus != vetoedComponent &&
            nextFocus.requestFocusInWindow(CausedFocusEvent.Cause.ROLLBACK))
        {
            return true;
        } else if (clearOnFailure) {
            clearGlobalFocusOwnerPriv();
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:DefaultKeyboardFocusManager.java

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

示例6: 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:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:WKeyboardFocusManagerPeer.java

示例7: 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:JetBrains,项目名称:jdk8u_jdk,代码行数:17,代码来源:LWLightweightFramePeer.java

示例8: processFocusEvent

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
public void processFocusEvent(FocusEvent e) {
    if (e.getID() == FocusEvent.FOCUS_GAINED) {
        if (e instanceof CausedFocusEvent) {
            if (((CausedFocusEvent) e).getCause() == CausedFocusEvent.Cause.TRAVERSAL_FORWARD) {
                if (impl.getModel().getRowCount() > 0) {
                    // if focus from cell editor
                    if (e.getSource() == impl && impl.getSelectedRow() >= 0) {
                        int selectedColumn = impl.getSelectedColumn();
                        focusTo(impl.getSelectedRow(), selectedColumn >= 0 ? selectedColumn : 0);
                    } else
                        moveToStart(0, 0);
                } else
                    impl.transferFocus();

            } else if (((CausedFocusEvent) e).getCause() == CausedFocusEvent.Cause.TRAVERSAL_BACKWARD) {
                if (impl.getModel().getRowCount() > 0) {
                    moveToEnd(impl.getRowCount() - 1, impl.getColumnCount() - 1);
                } else
                    impl.transferFocusBackward();
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:TableFocusManager.java

示例9: retargetUnexpectedFocusEvent

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
static FocusEvent retargetUnexpectedFocusEvent(FocusEvent fe) {
    synchronized (heavyweightRequests) {
        // Any other case represents a failure condition which we did
        // not expect. We need to clearFocusRequestList() and patch up
        // the event as best as possible.

        if (removeFirstRequest()) {
            return (FocusEvent)retargetFocusEvent(fe);
        }

        Component source = fe.getComponent();
        Component opposite = fe.getOppositeComponent();
        boolean temporary = false;
        if (fe.getID() == FocusEvent.FOCUS_LOST &&
            (opposite == null || isTemporary(opposite, source)))
        {
            temporary = true;
        }
        return new CausedFocusEvent(source, fe.getID(), temporary, opposite, 
                                    CausedFocusEvent.Cause.NATIVE_SYSTEM);
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:23,代码来源:KeyboardFocusManager.java

示例10: transferFocusBackward

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
/**
 * Transfers the focus to the previous component, as though this Component
 * were the focus owner.
 * @see       #requestFocus()
 * @since     1.4
 */
public void transferFocusBackward() {
    Container rootAncestor = getFocusCycleRootAncestor();
    Component comp = this;
    while (rootAncestor != null && 
           !(rootAncestor.isShowing() && 
             rootAncestor.isFocusable() && 
             rootAncestor.isEnabled())) 
    {
        comp = rootAncestor;
        rootAncestor = comp.getFocusCycleRootAncestor();
    }
    if (rootAncestor != null) {
        FocusTraversalPolicy policy =
            rootAncestor.getFocusTraversalPolicy();
        Component toFocus = policy.getComponentBefore(rootAncestor, comp);
        if (toFocus == null) {
            toFocus = policy.getDefaultComponent(rootAncestor);
        }
        if (toFocus != null) {
            toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD);
        }
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:30,代码来源:Component.java

示例11: doRestoreFocus

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
private boolean doRestoreFocus(Component toFocus, Component vetoedComponent,
			   boolean clearOnFailure)
   {
       if (toFocus.isShowing() && toFocus.isFocusable() &&
           toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) {
           return true;
} else {
           Component nextFocus = toFocus.preNextFocusHelper();
           if (nextFocus != vetoedComponent && Component.postNextFocusHelper(nextFocus)) {
               return true;
           } else if (clearOnFailure) {
               clearGlobalFocusOwner();
               return true;
           } else {
               return false;
           }
       }
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:19,代码来源:DefaultKeyboardFocusManager.java

示例12: addLightweightRequest

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
boolean addLightweightRequest(Component descendant,
                              boolean temporary, CausedFocusEvent.Cause cause) {
    if (log.isLoggable(PlatformLogger.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:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:25,代码来源:KeyboardFocusManager.java

示例13: transferFocus

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
boolean transferFocus(boolean clearOnFailure) {
    if (focusLog.isLoggable(PlatformLogger.FINER)) {
        focusLog.finer("clearOnFailure = " + clearOnFailure);
    }
    Component toFocus = getNextFocusCandidate();
    boolean res = false;
    if (toFocus != null && !toFocus.isFocusOwner() && toFocus != this) {
        res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_FORWARD);
    }
    if (clearOnFailure && !res) {
        if (focusLog.isLoggable(PlatformLogger.FINER)) {
            focusLog.finer("clear global focus owner");
        }
        KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
    }
    if (focusLog.isLoggable(PlatformLogger.FINER)) {
        focusLog.finer("returning result: " + res);
    }
    return res;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:21,代码来源:Component.java

示例14: doRestoreFocus

import sun.awt.CausedFocusEvent; //导入依赖的package包/类
private boolean doRestoreFocus(Component toFocus, Component vetoedComponent,
                               boolean clearOnFailure)
{
    if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.canBeFocusOwner() &&
        toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK))
    {
        return true;
    } else {
        Component nextFocus = toFocus.getNextFocusCandidate();
        if (nextFocus != null && nextFocus != vetoedComponent &&
            nextFocus.requestFocusInWindow(CausedFocusEvent.Cause.ROLLBACK))
        {
            return true;
        } else if (clearOnFailure) {
            clearGlobalFocusOwner();
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:22,代码来源:DefaultKeyboardFocusManager.java


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