Here you can find the source of convertShortcutMask(KeyStroke ks, int shortcutMask)
static KeyStroke convertShortcutMask(KeyStroke ks, int shortcutMask)
//package com.java2s; //License from project: Apache License import static java.awt.event.InputEvent.CTRL_DOWN_MASK; import static java.awt.event.InputEvent.CTRL_MASK; import java.awt.*; import javax.swing.*; public class Main { static KeyStroke convertShortcutMask(KeyStroke ks, int shortcutMask) { final int mod = ks.getModifiers(); if ((mod & (CTRL_DOWN_MASK | CTRL_MASK)) != 0) { final int newmod = mod & ~(CTRL_DOWN_MASK | CTRL_MASK) | shortcutMask; return KeyStroke.getKeyStroke(ks.getKeyCode(), newmod); }/*from w w w . j a v a 2s. c o m*/ return ks; } static KeyStroke getKeyStroke(String s) { KeyStroke ks = KeyStroke.getKeyStroke(s); if (ks != null && s.matches("(?i).*Ctrl.*")) { return convertShortcutMask(ks, getMenuShortcutKeyMask()); } return ks; } static int getMenuShortcutKeyMask() { return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); } }