@Test public void testParse() { final KeyStroke shortCut1 = AcceleratorParser.parse("cmd s"); assertNotNull(shortCut1); }
static KeyStroke parse(final String string) { if (string.startsWith(FUNCTION_KEY)) return KeyStroke.getKeyStroke(MOD_MAP.get(string), 0); int keyCode = 0; int modifierCode = 0; final StringTokenizer tokenizer = new StringTokenizer(string); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) modifierCode |= lookupModifier(token); else keyCode = lookupVKCode(token); } if (keyCode == 0) return null; return KeyStroke.getKeyStroke(keyCode, modifierCode); }
AcceleratorParser { static KeyStroke parse(final String string) { if (string.startsWith(FUNCTION_KEY)) return KeyStroke.getKeyStroke(MOD_MAP.get(string), 0); int keyCode = 0; int modifierCode = 0; final StringTokenizer tokenizer = new StringTokenizer(string); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) modifierCode |= lookupModifier(token); else keyCode = lookupVKCode(token); } if (keyCode == 0) return null; return KeyStroke.getKeyStroke(keyCode, modifierCode); } }
AcceleratorParser { static KeyStroke parse(final String string) { if (string.startsWith(FUNCTION_KEY)) return KeyStroke.getKeyStroke(MOD_MAP.get(string), 0); int keyCode = 0; int modifierCode = 0; final StringTokenizer tokenizer = new StringTokenizer(string); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) modifierCode |= lookupModifier(token); else keyCode = lookupVKCode(token); } if (keyCode == 0) return null; return KeyStroke.getKeyStroke(keyCode, modifierCode); }  }
AcceleratorParser { static KeyStroke parse(final String string) { if (string.startsWith(FUNCTION_KEY)) return KeyStroke.getKeyStroke(MOD_MAP.get(string), 0); int keyCode = 0; int modifierCode = 0; final StringTokenizer tokenizer = new StringTokenizer(string); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) modifierCode |= lookupModifier(token); else keyCode = lookupVKCode(token); } if (keyCode == 0) return null; return KeyStroke.getKeyStroke(keyCode, modifierCode); }   }
AcceleratorParser { static KeyStroke parse(final String string) { if (string.startsWith(FUNCTION_KEY)) return KeyStroke.getKeyStroke(MOD_MAP.get(string), 0); int keyCode = 0; int modifierCode = 0; final StringTokenizer tokenizer = new StringTokenizer(string); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (tokenizer.hasMoreTokens()) modifierCode |= lookupModifier(token); else keyCode = lookupVKCode(token); } if (keyCode == 0) return null; return KeyStroke.getKeyStroke(keyCode, modifierCode); }    }