當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。