本文整理汇总了Java中java.awt.event.InputEvent.META_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.META_MASK属性的具体用法?Java InputEvent.META_MASK怎么用?Java InputEvent.META_MASK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.InputEvent
的用法示例。
在下文中一共展示了InputEvent.META_MASK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModifierEx
public int getModifierEx() {
int modifiersEx = 0;
if (isShiftPressed()) {
modifiersEx |= InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK;
}
if (isCtrlPressed()) {
modifiersEx |= InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK;
}
if (isAltPressed()) {
modifiersEx |= InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK;
}
if (isMetaPressed()) {
modifiersEx |= InputEvent.META_DOWN_MASK | InputEvent.META_MASK;
}
return modifiersEx;
}
示例2: mapNewModifiers
private static int mapNewModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= InputEvent.SHIFT_MASK;
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
modifiers |= InputEvent.ALT_MASK;
}
if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
modifiers |= InputEvent.ALT_GRAPH_MASK;
}
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= InputEvent.CTRL_MASK;
}
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
modifiers |= InputEvent.META_MASK;
}
return modifiers;
}
示例3: mapNewModifiers
@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= InputEvent.SHIFT_MASK;
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
modifiers |= InputEvent.ALT_MASK;
}
if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
modifiers |= InputEvent.ALT_GRAPH_MASK;
}
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
modifiers |= InputEvent.CTRL_MASK;
}
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
modifiers |= InputEvent.META_MASK;
}
return modifiers;
}
示例4: keyPressed
@Override
public void keyPressed(KeyEvent e) {
keyPressReceived = true;
int code = e.getKeyCode();
assertEQ(code, keyCode, "wrong key code");
int mask = 0;
if (code == KeyEvent.VK_SHIFT) {
mask = InputEvent.SHIFT_MASK;
} else if (code == KeyEvent.VK_CONTROL) {
mask = InputEvent.CTRL_MASK;
} else if (code == KeyEvent.VK_ALT) {
mask = InputEvent.ALT_MASK;
} else if (code == KeyEvent.VK_META) {
mask = InputEvent.META_MASK;
}
int mod = e.getModifiers() & mask;
assertEQ(mod, mask, "invalid key mask");
synchronized (lock) { lock.notifyAll(); }
}
示例5: robotPressModifiers
private void robotPressModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
robotPressKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
} else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
robotPressKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
} else if ((modifiers & InputEvent.ALT_MASK) != 0) {
robotPressKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
} else if ((modifiers & InputEvent.META_MASK) != 0) {
robotPressKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
} else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
robotPressKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
}
}
示例6: getModifier
private int getModifier(int keycode) {
switch (keycode) {
case KeyEvent.VK_SHIFT:
return InputEvent.SHIFT_MASK;
case KeyEvent.VK_CONTROL:
return InputEvent.CTRL_MASK;
case KeyEvent.VK_ALT:
return InputEvent.ALT_MASK;
case KeyEvent.VK_META:
return InputEvent.META_MASK;
default:
throw new RuntimeException(OSUtils.keyEventGetKeyText(keycode) + " is not a valid modifier");
}
}
示例7: mapOldModifiers
private static int mapOldModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_MASK) != 0) {
modifiers |= InputEvent.ALT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
}
if ((modifiers & InputEvent.CTRL_MASK) != 0) {
modifiers |= InputEvent.CTRL_DOWN_MASK;
}
if ((modifiers & InputEvent.META_MASK) != 0) {
modifiers |= InputEvent.META_DOWN_MASK;
}
modifiers &= InputEvent.SHIFT_DOWN_MASK
| InputEvent.ALT_DOWN_MASK
| InputEvent.ALT_GRAPH_DOWN_MASK
| InputEvent.CTRL_DOWN_MASK
| InputEvent.META_DOWN_MASK
| InputEvent.BUTTON1_DOWN_MASK
| InputEvent.BUTTON2_DOWN_MASK
| InputEvent.BUTTON3_DOWN_MASK;
return modifiers;
}
示例8: setLabel
public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
int keyMask = modifiers;
if (keyCode == KeyEvent.VK_UNDEFINED) {
MenuShortcut shortcut = ((MenuItem)getTarget()).getShortcut();
if (shortcut != null) {
keyCode = shortcut.getKey();
keyMask |= InputEvent.META_MASK;
if (shortcut.usesShiftModifier()) {
keyMask |= InputEvent.SHIFT_MASK;
}
}
}
if (label == null) {
label = "";
}
// <rdar://problem/3654824>
// Native code uses a keyChar of 0 to indicate that the
// keyCode should be used to generate the shortcut. Translate
// CHAR_UNDEFINED into 0.
if (keyChar == KeyEvent.CHAR_UNDEFINED) {
keyChar = 0;
}
final String finalLabel = label;
final char finalKeyChar = keyChar;
final int finalKeyCode = keyCode;
final int finalKeyMask = keyMask;
execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar,
finalKeyCode, finalKeyMask));
}
示例9: robotReleaseModifiers
private void robotReleaseModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
robotReleaseKey(KeyEvent.VK_SHIFT, modifiers - (InputEvent.SHIFT_MASK & modifiers));
} else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
robotReleaseKey(KeyEvent.VK_ALT_GRAPH, modifiers - (InputEvent.ALT_GRAPH_MASK & modifiers));
} else if ((modifiers & InputEvent.ALT_MASK) != 0) {
robotReleaseKey(KeyEvent.VK_ALT, modifiers - (InputEvent.ALT_MASK & modifiers));
} else if ((modifiers & InputEvent.META_MASK) != 0) {
robotReleaseKey(KeyEvent.VK_META, modifiers - (InputEvent.META_MASK & modifiers));
} else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
robotReleaseKey(KeyEvent.VK_CONTROL, modifiers - (InputEvent.CTRL_MASK & modifiers));
}
}
示例10: mapOldModifiers
@SuppressWarnings("deprecation")
private static int mapOldModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_MASK) != 0) {
modifiers |= InputEvent.ALT_DOWN_MASK;
}
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
}
if ((modifiers & InputEvent.CTRL_MASK) != 0) {
modifiers |= InputEvent.CTRL_DOWN_MASK;
}
if ((modifiers & InputEvent.META_MASK) != 0) {
modifiers |= InputEvent.META_DOWN_MASK;
}
modifiers &= InputEvent.SHIFT_DOWN_MASK
| InputEvent.ALT_DOWN_MASK
| InputEvent.ALT_GRAPH_DOWN_MASK
| InputEvent.CTRL_DOWN_MASK
| InputEvent.META_DOWN_MASK
| InputEvent.BUTTON1_DOWN_MASK
| InputEvent.BUTTON2_DOWN_MASK
| InputEvent.BUTTON3_DOWN_MASK;
return modifiers;
}
示例11: setLabel
@SuppressWarnings("deprecation")
public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
int keyMask = modifiers;
if (keyCode == KeyEvent.VK_UNDEFINED) {
MenuShortcut shortcut = ((MenuItem)getTarget()).getShortcut();
if (shortcut != null) {
keyCode = shortcut.getKey();
keyMask |= InputEvent.META_MASK;
if (shortcut.usesShiftModifier()) {
keyMask |= InputEvent.SHIFT_MASK;
}
}
}
if (label == null) {
label = "";
}
// <rdar://problem/3654824>
// Native code uses a keyChar of 0 to indicate that the
// keyCode should be used to generate the shortcut. Translate
// CHAR_UNDEFINED into 0.
if (keyChar == KeyEvent.CHAR_UNDEFINED) {
keyChar = 0;
}
final String finalLabel = label;
final char finalKeyChar = keyChar;
final int finalKeyCode = keyCode;
final int finalKeyMask = keyMask;
execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar,
finalKeyCode, finalKeyMask));
}
示例12: pressModifiers
/**
* Presses modifiers keys by robot.
*
* @param modifiers a combination of {@code InputEvent.*_MASK} fields.
*/
protected void pressModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
pressKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
} else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
pressKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
} else if ((modifiers & InputEvent.ALT_MASK) != 0) {
pressKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
} else if ((modifiers & InputEvent.META_MASK) != 0) {
pressKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
} else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
pressKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
}
}
示例13: ctrlOrCmdModifier
private static boolean ctrlOrCmdModifier(MouseEvent e) {
if (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() == InputEvent.META_MASK) { // on Mac
return (e.getModifiersEx() & InputEvent.META_DOWN_MASK) == InputEvent.META_DOWN_MASK;
}
return (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK;
}
示例14: isLeftMouseButtonExt
private boolean isLeftMouseButtonExt(MouseEvent evt) {
return (SwingUtilities.isLeftMouseButton(evt)
&& !(evt.isPopupTrigger())
&& (evt.getModifiers() & (InputEvent.META_MASK | InputEvent.ALT_MASK)) == 0);
}
示例15: actionPerformed
@Override
public void actionPerformed(ActionEvent evt) {
boolean editors = true;
boolean views = !documentsOnly;
if( "immediately".equals( evt.getActionCommand() ) ) {
TopComponent activeTc = TopComponent.getRegistry().getActivated();
if( null != activeTc ) {
if( TopComponentTracker.getDefault().isEditorTopComponent( activeTc ) ) {
//switching in a document, go to some other document
views = false;
} else {
//switching in a view, go to some other view
editors = false;
views = true;
}
}
}
TopComponent[] documents = getRecentWindows(editors, views);
if (documents.length < 2) {
return;
}
if(!"immediately".equals(evt.getActionCommand()) && // NOI18N
!(evt.getSource() instanceof javax.swing.JMenuItem)) {
// #46800: fetch key directly from action command
KeyStroke keyStroke = Utilities.stringToKey(evt.getActionCommand());
if(keyStroke != null) {
int triggerKey = keyStroke.getKeyCode();
int reverseKey = KeyEvent.VK_SHIFT;
int releaseKey = 0;
int modifiers = keyStroke.getModifiers();
if((InputEvent.CTRL_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_CONTROL;
} else if((InputEvent.ALT_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_ALT;
} else if((InputEvent.META_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_META;
}
if(releaseKey != 0) {
if (!KeyboardPopupSwitcher.isShown()) {
KeyboardPopupSwitcher.showPopup(documentsOnly, releaseKey, triggerKey, (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0);
}
return;
}
}
}
int documentIndex = (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0 ? 1 : documents.length-1;
TopComponent tc = documents[documentIndex];
// #37226 Unmaximized the other mode if needed.
WindowManagerImpl wm = WindowManagerImpl.getInstance();
ModeImpl mode = (ModeImpl) wm.findMode(tc);
if(mode != null && mode != wm.getCurrentMaximizedMode()) {
wm.switchMaximizedMode(null);
}
tc.requestActive();
}