/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic should be either the symbolic name of one * of the KeyEvent.VK_* constants (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic */ public Integer getMnemonic( final String key ) { if ( key == null ) { throw new NullPointerException(); } final String name = strictString( key ); return createMnemonic( name ); }
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic should be either the symbolic name of one * of the KeyEvent.VK_* constants (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic or null, if the mnemonic is not defined. */ public Integer getOptionalMnemonic( final String key ) { if ( key == null ) { throw new NullPointerException(); } final String name = getOptionalString( key ); if ( name != null && name.length() > 0 ) { return createMnemonic( name ); } return INVALID_MNEMONIC; }
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic * should be either the symbolic name of one of the KeyEvent.VK_* constants * (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain * "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic */ public Integer getMnemonic(final String key) { if (key == null) { throw new NullPointerException(); } final String name = strictString(key); return createMnemonic(name); }
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic * should be either the symbolic name of one of the KeyEvent.VK_* constants * (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain * "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic or null, if the mnemonic is not defined. */ public Integer getOptionalMnemonic(final String key) { if (key == null) { throw new NullPointerException(); } final String name = getOptionalString(key); if (name != null && name.length() > 0) { return createMnemonic(name); } return INVALID_MNEMONIC; }
/** * Returns the keystroke stored at the given resourcebundle key. * <p/> * The keystroke will be composed of a simple key press and the given KeyMask. If the KeyMask is zero, a plain * Keystroke is returned. * <p/> * The keystrokes character key should be either the symbolic name of one of the KeyEvent.VK_* constants or the * character for that key. * <p/> * For the 'A' key, the resource bundle would therefore either contain "VK_A" or "a". * <pre> * a.resourcebundle.key=VK_A * an.other.resourcebundle.key=a * </pre> * * @param key the resourcebundle key * @param mask the key-moifier mask to be used to create the keystroke. * @return the keystroke that has been generated. * @see java.awt.Toolkit#getMenuShortcutKeyMask() */ public KeyStroke getKeyStroke( final String key, final int mask ) { if ( key == null ) { throw new NullPointerException(); } final String name = strictString( key ); //noinspection MagicConstant return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask ); }
return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask );
return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask );
return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask ); } catch ( MissingResourceException mre ) { return null;
return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);