Java Swing Key Event keyStrokeModMac(String keyStrokeStr)

Here you can find the source of keyStrokeModMac(String keyStrokeStr)

Description

key Stroke Mod Mac

License

Apache License

Declaration

private static int keyStrokeModMac(String keyStrokeStr) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.awt.*;

import java.awt.event.*;

public class Main {
    private static int keyStrokeModMac(String keyStrokeStr) {
        keyStrokeStr = keyStrokeStr.toLowerCase();
        int mod = 0;
        if (keyStrokeStr.contains("ctrl") || keyStrokeStr.contains("control")) {
            mod = mod | InputEvent.CTRL_MASK;
        }/*w ww . j av  a2 s  . co m*/
        if (keyStrokeStr.contains("alt")) {
            mod = mod | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
        }
        if (keyStrokeStr.contains("meta")) {
            mod = mod | InputEvent.ALT_MASK;
        }
        return mod;
    }
}

Related

  1. checkRowDownEvent(KeyEvent evt)
  2. esFecha(KeyEvent e)
  3. insertKeyListener(Component component, KeyListener l, int index)
  4. keyEventGetKeyText(int keycode)
  5. keyEventModifiersToKeyStrokeModifiers(int modifiers)
  6. press(int key)
  7. pressKey(final int key)
  8. recipientHintSelected(String hintString, TextField toList, boolean shiftKeyPressed)
  9. rejectNonNumericKeys(KeyEvent evt)