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