本文整理汇总了Java中java.awt.event.ActionEvent.ALT_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.ALT_MASK属性的具体用法?Java ActionEvent.ALT_MASK怎么用?Java ActionEvent.ALT_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.ActionEvent
的用法示例。
在下文中一共展示了ActionEvent.ALT_MASK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidDefaultTypedAction
/**
* Checks that the action will result in an insertion into document.
* Returns true for readonly docs as well.
*
* @param evt action event
* @return true, if the action event will result in insertion; readonly doc status is not
* checked.
*/
static boolean isValidDefaultTypedAction(ActionEvent evt) {
// Check whether the modifiers are OK
int mod = evt.getModifiers();
boolean ctrl = ((mod & ActionEvent.CTRL_MASK) != 0);
boolean alt = org.openide.util.Utilities.isMac() ? ((mod & ActionEvent.META_MASK) != 0) :
((mod & ActionEvent.ALT_MASK) != 0);
return !(alt || ctrl);
}
示例2: isValidDefaultTypedAction
/**
* Copied from BaseKit
*/
static boolean isValidDefaultTypedAction(ActionEvent evt) {
// Check whether the modifiers are OK
int mod = evt.getModifiers();
boolean ctrl = ((mod & ActionEvent.CTRL_MASK) != 0);
boolean alt = org.openide.util.Utilities.isMac() ? ((mod & ActionEvent.META_MASK) != 0) :
((mod & ActionEvent.ALT_MASK) != 0);
return !(alt || ctrl);
}
示例3: actionPerformed
/**
* This method is final so that you cannot override it and mess up the
* macro-recording part of it. The actual meat of the action is in
* <code>actionPerformedImpl</code>.
*
* @param e The action being performed.
* @see #actionPerformedImpl
*/
@Override
public final void actionPerformed(ActionEvent e) {
JTextComponent textComponent = getTextComponent(e);
if (textComponent instanceof RTextArea) {
RTextArea textArea = (RTextArea)textComponent;
//System.err.println("Recordable action: " + getMacroID());
if (RTextArea.isRecordingMacro() && isRecordable()) {
int mod = e.getModifiers();
// We ignore keypresses involving ctrl/alt/meta if they are
// "default" keypresses - i.e., they aren't some special
// action like paste (e.g., paste would return Ctrl+V, but
// its action would be "paste-action").
String macroID = getMacroID();
//System.err.println(macroID);
//System.err.println("... " + (mod&ActionEvent.ALT_MASK));
//System.err.println("... " + (mod&ActionEvent.CTRL_MASK));
//System.err.println("... " + (mod&ActionEvent.META_MASK));
if (!DefaultEditorKit.defaultKeyTypedAction.equals(macroID) || (
(mod&ActionEvent.ALT_MASK)==0 &&
(mod&ActionEvent.CTRL_MASK)==0 &&
(mod&ActionEvent.META_MASK)==0)
) {
String command = e.getActionCommand();
RTextArea.addToCurrentMacro(macroID, command);
//System.err.println("... recording it!");
}
}
actionPerformedImpl(e, textArea);
}
}