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