本文整理匯總了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();
}
}