/** * Returns an unscaled icon. * * @param key the name of the resource bundle key * @return the icon. */ public Icon getIcon(final String key) { final String name = getString(key); return createIcon(name, false, false); }
public Integer getOptionalMnemonic(final String key) { final String name = getString(key); if (name != null && name.length() > 0) { return createMnemonic(name); } return null; }
/** * Creates a transparent icon. The Icon can be used for aligning menu * items. * * @param width the width of the new icon * @param height the height of the new icon * @return the created transparent icon. */ public Icon createTransparentIcon(final int width, final int height) { return new ImageIcon(createTransparentImage(width, height)); }
/** * Returns an optional key stroke. * * @param key the key. * * @return The key stroke. */ public KeyStroke getOptionalKeyStroke(final String key) { return getOptionalKeyStroke(key, getMenuKeyMask()); }
/** * Formats the message stored in the resource bundle (using a * MessageFormat). * * @param key the resourcebundle key * @param parameters the parameter collection for the message * @return the formated string */ public String formatMessage(final String key, final Object[] parameters) { final MessageFormat format = new MessageFormat(getString(key)); format.setLocale(getLocale()); return format.format(parameters); }
/** * Returns the keystroke stored at the given resourcebundle key. * <p/> * The keystroke will be composed of a simple key press and the plattform's * MenuKeyMask. * <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 * @return the mnemonic * @see Toolkit#getMenuShortcutKeyMask() */ public KeyStroke getKeyStroke(final String key) { return getKeyStroke(key, getMenuKeyMask()); }
/** * Returns a JMenu created from a resource bundle definition. * <p> * The menu definition consists of two keys, the name of the menu and the * mnemonic for that menu. Both keys share a common prefix, which is * extended by ".name" for the name of the menu and ".mnemonic" for the * mnemonic.</p> * * <pre> * # define the file menu * menu.file.name=File * menu.file.mnemonic=F * </pre> * The menu definition above can be used to create the menu by calling * <code>createMenu ("menu.file")</code>. * * @param keyPrefix the common prefix for that menu * @return the created menu */ public JMenu createMenu(final String keyPrefix) { final JMenu retval = new JMenu(); retval.setText(getString(keyPrefix + ".name")); retval.setMnemonic(getMnemonic(keyPrefix + ".mnemonic").intValue()); return retval; }
getResourceBase(), this.lookupPath.toString()); ("Invalid format for global lookup key.", getResourceBase(), key); ("Error during global lookup", getResourceBase(), key); final String retval = internalGetString(newKey);
/** * Formats the message stored in the resource bundle (using a * MessageFormat). * * @param key the resourcebundle key * @param parameter the parameter for the message * @return the formated string */ public String formatMessage(final String key, final Object parameter) { return formatMessage(key, new Object[]{parameter}); }
/** * Returns an optional key stroke. * * @param key the key. * * @return The key stroke. */ public KeyStroke getOptionalKeyStroke(final String key) { return getOptionalKeyStroke(key, getMenuKeyMask()); }
/** * Formats the message stored in the resource bundle (using a * MessageFormat). * * @param key the resourcebundle key * @param parameters the parameter collection for the message * @return the formated string */ public String formatMessage(final String key, final Object[] parameters) { final MessageFormat format = new MessageFormat(getString(key)); format.setLocale(getLocale()); return format.format(parameters); }
/** * Returns the keystroke stored at the given resourcebundle key. * <p> * The keystroke will be composed of a simple key press and the platform's * MenuKeyMask.</p> * <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> * <p> * For the 'A' key, the resource bundle would therefore either contain * "VK_A" or "a".</p> * <pre> * a.resourcebundle.key=VK_A * an.other.resourcebundle.key=a * </pre> * * @param key the resourcebundle key * @return the mnemonic * @see Toolkit#getMenuShortcutKeyMask() */ public KeyStroke getKeyStroke(final String key) { return getKeyStroke(key, getMenuKeyMask()); }
/** * Returns a JMenu created from a resource bundle definition. * <p/> * The menu definition consists of two keys, the name of the menu and the * mnemonic for that menu. Both keys share a common prefix, which is * extended by ".name" for the name of the menu and ".mnemonic" for the * mnemonic. * <p/> * <pre> * # define the file menu * menu.file.name=File * menu.file.mnemonic=F * </pre> * The menu definition above can be used to create the menu by calling * <code>createMenu ("menu.file")</code>. * * @param keyPrefix the common prefix for that menu * @return the created menu */ public JMenu createMenu(final String keyPrefix) { final JMenu retval = new JMenu(); retval.setText(getString(keyPrefix + ".name")); retval.setMnemonic(getMnemonic(keyPrefix + ".mnemonic").intValue()); return retval; }
getResourceBase(), this.lookupPath.toString()); ("Invalid format for global lookup key.", getResourceBase(), key); ("Error during global lookup", getResourceBase(), key); final String retval = internalGetString(newKey);
/** * Formats the message stored in the resource bundle (using a * MessageFormat). * * @param key the resourcebundle key * @param parameter the parameter for the message * @return the formated string */ public String formatMessage(final String key, final Object parameter) { return formatMessage(key, new Object[]{parameter}); }
/** * 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) { final String name = getString(key); return createMnemonic(name); }
/** * Returns an unscaled icon. * * @param key the name of the resource bundle key * @return the icon. */ public Icon getIcon(final String key) { final String name = getString(key); return createIcon(name, false, false); }
public KeyStroke getOptionalKeyStroke(final String key) { return getOptionalKeyStroke(key, getMenuKeyMask()); }
/** * Formats the message stored in the resource bundle (using a * MessageFormat). * * @param key the resourcebundle key * @param parameters the parameter collection for the message * @return the formated string */ public String formatMessage(final String key, final Object[] parameters) { final MessageFormat format = new MessageFormat(getString(key)); format.setLocale(getLocale()); return format.format(parameters); }
/** * Returns the keystroke stored at the given resourcebundle key. * <p/> * The keystroke will be composed of a simple key press and the plattform's * MenuKeyMask. * <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 * @return the mnemonic * @see Toolkit#getMenuShortcutKeyMask() */ public KeyStroke getKeyStroke(final String key) { return getKeyStroke(key, getMenuKeyMask()); }