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


Java FocusEvent.getID方法代码示例

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


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

示例1: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);

    //Remove the editor here if the new focus owner is not
    //known to the table & the focus event is not temporary
    if ((fe.getID() == FocusEvent.FOCUS_LOST) && !fe.isTemporary() && !inRemoveRequest && !inEditRequest) {
        boolean stopEditing = ((fe.getOppositeComponent() != getParent()) &&
            !isKnownComponent(fe.getOppositeComponent()) && (fe.getOppositeComponent() != null));

        if (stopEditing) {
            removeEditor();
        }
    }

    //The UI will only repaint the lead selection, but we need to
    //paint all selected rows for the color to change when focus
    //is lost/gained
    if (!inRemoveRequest && !inEditRequest) {
        repaintSelection(fe.getID() == FocusEvent.FOCUS_GAINED);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:TreeTable.java

示例2: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Overridden to check the focus event countdown and initiate editing on
 * the second focus event following a failed edit (dialog was shown) */
@Override
public void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);

    if (fe.getID() == fe.FOCUS_GAINED) {
        countDown--;

        if (countDown == 0) {
            autoEdit();
        }
    }

    if (
        (fe.getID() == fe.FOCUS_GAINED) ||
            ((fe.getOppositeComponent() != null) && (fe.getID() == fe.FOCUS_LOST) &&
            !isAncestorOf(fe.getOppositeComponent()))
    ) {
        //Ensure the description goes back to the node description if
        //we lose focus
        fireChange();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:SheetTable.java

示例3: retargetUnexpectedFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的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

示例4: retargetUnexpectedFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的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 FocusEvent(source, fe.getID(), temporary, opposite,
                                    FocusEvent.Cause.UNEXPECTED);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:KeyboardFocusManager.java

示例5: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
protected void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);

    if ((fe.getID() == FocusEvent.FOCUS_GAINED) && (inner != null)) {
        inner.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EditorPropertyDisplayer.java

示例6: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/** Overridden to remove the editor on focus lost */
public void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);

    if (PropUtils.isLoggable(BaseTable.class)) {
        PropUtils.log(BaseTable.class, "processFocusEvent - "); //NOI18N
        PropUtils.log(BaseTable.class, fe);
    }

    if (!isAncestorOf(fe.getOppositeComponent()) || (fe.getOppositeComponent() == null)) {
        if (isEditing() && (fe.getID() == fe.FOCUS_LOST)) {
            if (PropUtils.isLoggable(BaseTable.class)) {
                PropUtils.log(
                    BaseTable.class, "ProcessFocusEvent got focus lost to unknown component, removing editor"
                ); //NOI18N
            }

            focusLostCancel();
        }
    }

    if (!inEditorRemoveRequest() && !inEditRequest()) { //XXX inEditRequest probably shouldn't be here

        if ((fe.getOppositeComponent() == null) && (fe.getID() == fe.FOCUS_LOST)) {
            //ignore the strange focus to null stuff NetBeans does
            return;
        }

        paintSelectionRow();
    } else {
        paintSelectionRow();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:BaseTable.java

示例7: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
protected void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);

    if (fe.getID() == fe.FOCUS_GAINED) {
        if ((inner != null) && inner.isEnabled() && inner.isFocusTraversable()) {
            inner.requestFocus();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PropertyPanel.java

示例8: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);
    if (fe.getID() == fe.FOCUS_LOST) {
        stopTimer();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TabControlButtonFactory.java

示例9: processFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
protected void processFocusEvent(FocusEvent fe) {
    super.processFocusEvent(fe);
    if (fe.getID() == FocusEvent.FOCUS_LOST) {
        stopTimer();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ButtonFactory.java

示例10: handleJavaFocusEvent

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
 * Restoring native behavior. We should sets the selection range to zero,
 * when component lost its focus.
 *
 * @param e the focus event
 */
@Override
void handleJavaFocusEvent(final FocusEvent e) {
    if (e.getID() == FocusEvent.FOCUS_LOST) {
        // In order to de-select the selection
        setCaretPosition(0);
    }
    super.handleJavaFocusEvent(e);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:LWTextFieldPeer.java

示例11: forwardFocusLost

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusLost( FocusEvent e) {
    isFocused = false;
    FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
            e.getOppositeComponent(), e.getCause());
    super.processFocusEvent(fe);

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

示例12: forwardFocusGained

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
void forwardFocusGained( FocusEvent e) {
    isFocused = true;
    FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
            e.getOppositeComponent(), e.getCause());
    super.processFocusEvent(fe);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:XTextFieldPeer.java

示例13: retarget

import java.awt.event.FocusEvent; //导入方法依赖的package包/类
/**
 * Retargets the original focus event to the new target.  If the
 * original focus event is CausedFocusEvent, it remains such and
 * cause is copied.  Otherwise, new CausedFocusEvent is created,
 * with cause as RETARGETED.
 * @return retargeted event, or null if e is null
 */
public static FocusEvent retarget(FocusEvent e, Component newSource) {
    if (e == null) return null;

    return new CausedFocusEvent(newSource, e.getID(), e.isTemporary(), e.getOppositeComponent(),
                                (e instanceof CausedFocusEvent) ? ((CausedFocusEvent)e).getCause() : Cause.RETARGETED);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:CausedFocusEvent.java


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