當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractAction.actionPerformed方法代碼示例

本文整理匯總了Java中javax.swing.AbstractAction.actionPerformed方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractAction.actionPerformed方法的具體用法?Java AbstractAction.actionPerformed怎麽用?Java AbstractAction.actionPerformed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.AbstractAction的用法示例。


在下文中一共展示了AbstractAction.actionPerformed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processInterruption

import javax.swing.AbstractAction; //導入方法依賴的package包/類
/**
 * Prevents showing a popup if a user releases the <code>releaseKey</code>
 * in time specified by <code>invokerTimer</code> (which is 200ms by
 * default).
 */
private static void processInterruption(KeyEvent kev) {
    int keyCode = kev.getKeyCode();
    if (keyCode == releaseKey && kev.getID() == KeyEvent.KEY_RELEASED) {
        // if an user releases Ctrl-Tab before the time to show
        // popup expires, don't show the popup at all and switch to
        // the last used document immediately
        cleanupInterrupter();
        hits = 0;
        AbstractAction rva = new ThreadsHistoryAction();
        rva.actionPerformed(new ActionEvent(kev.getSource(),
                ActionEvent.ACTION_PERFORMED,
                "immediately", kev.getModifiers())); // NOI18N
        kev.consume();
    // #88931: Need to react to KEY_PRESSED, not KEY_RELEASED, to not miss the hit    
    } else if (keyCode == triggerKey
            && kev.getModifiers() == InputEvent.CTRL_MASK
            && kev.getID() == KeyEvent.KEY_PRESSED) {
        // count number of trigger key hits before popup is shown
        hits++;
        kev.consume();
        cleanupInterrupter();
        instance = new KeyboardPopupSwitcher(hits + 1, true);
        instance.showPopup();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:KeyboardPopupSwitcher.java


注:本文中的javax.swing.AbstractAction.actionPerformed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。