当前位置: 首页>>代码示例>>Java>>正文


Java InputEvent.META_DOWN_MASK属性代码示例

本文整理汇总了Java中java.awt.event.InputEvent.META_DOWN_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.META_DOWN_MASK属性的具体用法?Java InputEvent.META_DOWN_MASK怎么用?Java InputEvent.META_DOWN_MASK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.InputEvent的用法示例。


在下文中一共展示了InputEvent.META_DOWN_MASK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyTyped

@Override
public void keyTyped(KeyEvent e) {
	int ign = InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK;
	if ((e.getModifiersEx() & ign) != 0)
		return;

	char c = e.getKeyChar();
	if (c == '\n') {
		stopEditing();
	} else if (c != KeyEvent.CHAR_UNDEFINED && !Character.isISOControl(c)) {
		if (pos < curText.length()) {
			curText = curText.substring(0, pos) + c + curText.substring(pos);
		} else {
			curText += c;
		}
		++pos;
		field.setText(curText);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:19,代码来源:TextFieldCaret.java

示例2: toKeyDisplayString

public static String toKeyDisplayString(int mods) {
	ArrayList<String> arr = new ArrayList<String>();
	if ((mods & InputEvent.META_DOWN_MASK) != 0)
		arr.add(Strings.get("metaMod"));
	if ((mods & InputEvent.CTRL_DOWN_MASK) != 0)
		arr.add(Strings.get("ctrlMod"));
	if ((mods & InputEvent.ALT_DOWN_MASK) != 0)
		arr.add(Strings.get("altMod"));
	if ((mods & InputEvent.SHIFT_DOWN_MASK) != 0)
		arr.add(Strings.get("shiftMod"));

	Iterator<String> it = arr.iterator();
	if (it.hasNext()) {
		StringBuilder ret = new StringBuilder();
		ret.append(it.next());
		while (it.hasNext()) {
			ret.append(" ");
			ret.append(it.next());
		}
		return ret.toString();
	} else {
		return "";
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:24,代码来源:InputEventUtil.java

示例3: 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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:WizardUtils.java

示例4: stringToKeyStroke

public static KeyStroke stringToKeyStroke(String keyStroke) {
    int modifiers = 0;
    if (keyStroke.startsWith("Ctrl+")) { // NOI18N
        modifiers |= InputEvent.CTRL_DOWN_MASK;
        keyStroke = keyStroke.substring(5);
    }
    if (keyStroke.startsWith("Alt+")) { // NOI18N
        modifiers |= InputEvent.ALT_DOWN_MASK;
        keyStroke = keyStroke.substring(4);
    }
    if (keyStroke.startsWith("Shift+")) { // NOI18N
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
        keyStroke = keyStroke.substring(6);
    }
    if (keyStroke.startsWith("Meta+")) { // NOI18N
        modifiers |= InputEvent.META_DOWN_MASK;
        keyStroke = keyStroke.substring(5);
    }
    KeyStroke ks = Utilities.stringToKey(keyStroke);
    if (ks == null) {
        return null;
    }
    KeyStroke result = KeyStroke.getKeyStroke(ks.getKeyCode(), modifiers);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:WizardUtils.java

示例5: main

public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:bug7170657.java

示例6: 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AWTKeyStroke.java

示例7: 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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:EventQueueDevice.java

示例8: 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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:AWTKeyStroke.java

示例9: 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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:KeyStrokeUtils.java

示例10: getKeyStrokeAsText

private static String getKeyStrokeAsText(KeyStroke keyStroke) {
    int modifiers = keyStroke.getModifiers();
    StringBuilder sb = new StringBuilder();
    sb.append('\'');
    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(org.openide.util.Utilities.keyToString(
                KeyStroke.getKeyStroke(keyStroke.getKeyCode(), 0)
        ));
    }
    sb.append('\'');
    return sb.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:InstantRefactoringPerformer.java

示例11: 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:AWTKeyStroke.java

示例12: 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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:AWTKeyStroke.java

示例13: getCharSequence

public String getCharSequence(String keys) {
    StringBuilder sb = new StringBuilder();
    if (keys.length() == 1) {
        sb.append(keys);
    } else {
        KeyStrokeParser ksp = new KeyStrokeParser(keys);
        KeyStroke ks = ksp.getKeyStroke();
        CharSequence keys2 = keyMapping.get(ks.getKeyCode());
        if (keys2 == null) {
            String keysText = KeyEvent.getKeyText(ks.getKeyCode());
            if (keysText.length() == 1 && Character.isUpperCase(keysText.charAt(0))) {
                keysText = keysText.toLowerCase();
            }
            keys2 = keysText;
        }
        int modifiers = ks.getModifiers();
        if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
            sb.append(Keys.SHIFT);
        }
        if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
            sb.append(Keys.CONTROL);
        }
        if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
            sb.append(Keys.META);
        }
        if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
            sb.append(Keys.ALT);
        }
        sb.append(keys2);
    }
    return sb.toString();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:32,代码来源:Marathon.java

示例14: 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();
    }
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:37,代码来源:DeviceTest.java

示例15: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:GlassPane.java


注:本文中的java.awt.event.InputEvent.META_DOWN_MASK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。