本文整理汇总了Java中java.awt.event.InputEvent.SHIFT_DOWN_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.SHIFT_DOWN_MASK属性的具体用法?Java InputEvent.SHIFT_DOWN_MASK怎么用?Java InputEvent.SHIFT_DOWN_MASK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.InputEvent
的用法示例。
在下文中一共展示了InputEvent.SHIFT_DOWN_MASK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyStrokeToString
public static String keyStrokeToString(KeyStroke keyStroke) {
int modifiers = keyStroke.getModifiers();
StringBuffer sb = new StringBuffer();
if ((modifiers & InputEvent.CTRL_DOWN_MASK) > 0) {
sb.append("Ctrl+"); // NOI18N
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) > 0) {
sb.append("Alt+"); // NOI18N
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) > 0) {
sb.append("Shift+"); // NOI18N
}
if ((modifiers & InputEvent.META_DOWN_MASK) > 0) {
sb.append("Meta+"); // NOI18N
}
if (keyStroke.getKeyCode() != KeyEvent.VK_SHIFT &&
keyStroke.getKeyCode() != KeyEvent.VK_CONTROL &&
keyStroke.getKeyCode() != KeyEvent.VK_META &&
keyStroke.getKeyCode() != KeyEvent.VK_ALT &&
keyStroke.getKeyCode() != KeyEvent.VK_ALT_GRAPH) {
sb.append(Utilities.keyToString(
KeyStroke.getKeyStroke(keyStroke.getKeyCode(), 0)));
}
return sb.toString();
}
示例2: setOldModifiers
/**
* Sets old modifiers by the new ones.
*/
private void setOldModifiers() {
if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON1_MASK;
}
if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON2_MASK;
}
if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON3_MASK;
}
if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.SHIFT_MASK;
}
if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.CTRL_MASK;
}
if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
}
}
示例3: getModifiers
/**
* Converts XEMBED modifiers mask into AWT InputEvent mask
*/
int getModifiers(int state) {
int mods = 0;
if ((state & XEMBED_MODIFIER_SHIFT) != 0) {
mods |= InputEvent.SHIFT_DOWN_MASK;
}
if ((state & XEMBED_MODIFIER_CONTROL) != 0) {
mods |= InputEvent.CTRL_DOWN_MASK;
}
if ((state & XEMBED_MODIFIER_ALT) != 0) {
mods |= InputEvent.ALT_DOWN_MASK;
}
// FIXME: What is super/hyper?
// FIXME: Experiments show that SUPER is ALT. So what is Alt then?
if ((state & XEMBED_MODIFIER_SUPER) != 0) {
mods |= InputEvent.ALT_DOWN_MASK;
}
// if ((state & XEMBED_MODIFIER_HYPER) != 0) {
// mods |= InputEvent.DOWN_MASK;
// }
return mods;
}
示例4: fromDisplayString
public static int fromDisplayString(String str) {
int ret = 0;
StringTokenizer toks = new StringTokenizer(str);
while (toks.hasMoreTokens()) {
String s = toks.nextToken();
if (s.equals(Strings.get("ctrlMod")))
ret |= InputEvent.CTRL_DOWN_MASK;
else if (s.equals(Strings.get("altMod")))
ret |= InputEvent.ALT_DOWN_MASK;
else if (s.equals(Strings.get("shiftMod")))
ret |= InputEvent.SHIFT_DOWN_MASK;
else if (s.equals(Strings.get("button1Mod")))
ret |= InputEvent.BUTTON1_DOWN_MASK;
else if (s.equals(Strings.get("button2Mod")))
ret |= InputEvent.BUTTON2_DOWN_MASK;
else if (s.equals(Strings.get("button3Mod")))
ret |= InputEvent.BUTTON3_DOWN_MASK;
else
throw new NumberFormatException("InputEventUtil");
}
return ret;
}
示例5: getKeyModifierText
public static String getKeyModifierText(int modifiers) {
if (modifiers == 0) {
return "";
}
StringBuffer sb = new StringBuffer();
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
sb.append("Ctrl+");
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
sb.append("Alt+");
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
sb.append("Shift+");
}
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
sb.append("Meta+");
}
return sb.toString();
}
示例6: 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;
}
示例7: setNewModifiers
/**
* Sets new modifiers by the old ones.
* The mouse modifiers have higher priority than overlaying key
* modifiers.
*/
private void setNewModifiers() {
if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
}
if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
}
if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
}
if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
}
if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
}
if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
}
}
示例8: getKeyStroke
/**
* Convert human-readable keystroke name to {@link KeyStroke} object.
*/
public static @CheckForNull KeyStroke getKeyStroke(
@NonNull String keyStroke) {
int modifiers = 0;
while (true) {
if (keyStroke.startsWith(EMACS_CTRL)) {
modifiers |= InputEvent.CTRL_DOWN_MASK;
keyStroke = keyStroke.substring(EMACS_CTRL.length());
} else if (keyStroke.startsWith(EMACS_ALT)) {
modifiers |= InputEvent.ALT_DOWN_MASK;
keyStroke = keyStroke.substring(EMACS_ALT.length());
} else if (keyStroke.startsWith(EMACS_SHIFT)) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
keyStroke = keyStroke.substring(EMACS_SHIFT.length());
} else if (keyStroke.startsWith(EMACS_META)) {
modifiers |= InputEvent.META_DOWN_MASK;
keyStroke = keyStroke.substring(EMACS_META.length());
} else if (keyStroke.startsWith(STRING_ALT)) {
modifiers |= InputEvent.ALT_DOWN_MASK;
keyStroke = keyStroke.substring(STRING_ALT.length());
} else if (keyStroke.startsWith(STRING_META)) {
modifiers |= InputEvent.META_DOWN_MASK;
keyStroke = keyStroke.substring(STRING_META.length());
} else {
break;
}
}
KeyStroke ks = Utilities.stringToKey (keyStroke);
if (ks == null) { // Return null to indicate an invalid keystroke
return null;
} else {
KeyStroke result = KeyStroke.getKeyStroke (ks.getKeyCode (), modifiers);
return result;
}
}
示例9: getKeyStrokeAsText
/**
* Get human-readable name for a {@link KeyStroke}.
*/
public static String getKeyStrokeAsText(@NonNull KeyStroke keyStroke) {
int modifiers = keyStroke.getModifiers ();
StringBuilder sb = new StringBuilder ();
if ((modifiers & InputEvent.CTRL_DOWN_MASK) > 0) {
sb.append(EMACS_CTRL);
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) > 0) {
sb.append(STRING_ALT);
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) > 0) {
sb.append (EMACS_SHIFT);
}
if ((modifiers & InputEvent.META_DOWN_MASK) > 0) {
sb.append(STRING_META);
}
if (keyStroke.getKeyCode () != KeyEvent.VK_SHIFT &&
keyStroke.getKeyCode () != KeyEvent.VK_CONTROL &&
keyStroke.getKeyCode () != KeyEvent.VK_META &&
keyStroke.getKeyCode () != KeyEvent.VK_ALT &&
keyStroke.getKeyCode () != KeyEvent.VK_ALT_GRAPH) {
sb.append (Utilities.keyToString (
KeyStroke.getKeyStroke (keyStroke.getKeyCode (), 0)
));
}
return sb.toString ();
}
示例10: testLassoConditions
private boolean testLassoConditions(MouseEvent e) {
int onmask = InputEvent.BUTTON1_DOWN_MASK;
int offmask = InputEvent.CTRL_DOWN_MASK
| InputEvent.SHIFT_DOWN_MASK;
return (e.getModifiersEx() & (onmask | offmask)) == onmask
&& (enabled || isLDown);
}
示例11: getModifiersText
static String getModifiersText(int modifiers) {
StringBuilder buf = new StringBuilder();
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0 ) {
buf.append("shift ");
}
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0 ) {
buf.append("ctrl ");
}
if ((modifiers & InputEvent.META_DOWN_MASK) != 0 ) {
buf.append("meta ");
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0 ) {
buf.append("alt ");
}
if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0 ) {
buf.append("altGraph ");
}
if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0 ) {
buf.append("button1 ");
}
if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0 ) {
buf.append("button2 ");
}
if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0 ) {
buf.append("button3 ");
}
return buf.toString();
}
示例12: getModifiersExText
protected String getModifiersExText(int modifiers) {
StringBuffer buf = new StringBuffer();
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
buf.append("Meta");
buf.append("+");
}
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
buf.append("Ctrl");
buf.append("+");
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
buf.append("Alt");
buf.append("+");
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
buf.append("Shift");
buf.append("+");
}
if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
buf.append("Alt Graph");
buf.append("+");
}
if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
buf.append("Button1");
buf.append("+");
}
if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
buf.append("Button2");
buf.append("+");
}
if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
buf.append("Button3");
buf.append("+");
}
return buf.toString();
}
示例13: inputEventGetModifiersExText
public static String inputEventGetModifiersExText(int modifiers) {
StringBuffer sb = new StringBuffer();
if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
sb.append("Ctrl+");
}
if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
sb.append("Meta+");
}
if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
sb.append("Alt+");
}
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
sb.append("Shift+");
}
if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
sb.append("Button1+");
}
if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
sb.append("Button2+");
}
if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
sb.append("Button3+");
}
String text = sb.toString();
if (text.equals("")) {
return text;
}
return text.substring(0, text.length() - 1);
}
示例14: 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;
}
示例15: shouldConnect
private boolean shouldConnect(Canvas canvas, int modsEx) {
boolean shiftReleased = (modsEx & InputEvent.SHIFT_DOWN_MASK) == 0;
boolean dflt = AppPreferences.MOVE_KEEP_CONNECT.getBoolean();
if (shiftReleased) {
return dflt;
} else {
return !dflt;
}
}