X-Git-Url: https://git.pterodactylus.net/?p=jkeytool.git;a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Fi18n%2Fgui%2FI18nAction.java;fp=src%2Fnet%2Fpterodactylus%2Futil%2Fi18n%2Fgui%2FI18nAction.java;h=0682b35f641637d992e272834c94bfec9e9e6258;hp=60783358c2fbb13162e06d281171fd6515ddb1b2;hb=35bfd61e813bd2545c290ef6decdb987cbc9979d;hpb=e9054ed5d01d2726743059bfef19b349edd5720e diff --git a/src/net/pterodactylus/util/i18n/gui/I18nAction.java b/src/net/pterodactylus/util/i18n/gui/I18nAction.java index 6078335..0682b35 100644 --- a/src/net/pterodactylus/util/i18n/gui/I18nAction.java +++ b/src/net/pterodactylus/util/i18n/gui/I18nAction.java @@ -1,4 +1,3 @@ - package net.pterodactylus.util.i18n.gui; import javax.swing.AbstractAction; @@ -22,43 +21,51 @@ public abstract class I18nAction extends AbstractAction implements I18nable { * Creates a new action that uses the given name as base name to get values * from {@link I18n}. * + * @param i18n + * The I18n container * @param i18nName * The base name of the action */ - public I18nAction(String i18nName) { - this(i18nName, null); + public I18nAction(I18n i18n, String i18nName) { + this(i18n, i18nName, null); } /** * Creates a new action that uses the given name as base name to get values * from {@link I18n} and the given icon. * + * @param i18n + * The I18n container * @param i18nName * The base name of the action * @param icon * The icon for the action */ - public I18nAction(String i18nName, Icon icon) { - this(i18nName, true, icon); + public I18nAction(I18n i18n, String i18nName, Icon icon) { + this(i18n, i18nName, true, icon); } /** * Creates a new action that uses the given name as base name to get values * from {@link I18n}. * + * @param i18n + * The I18n container * @param i18nName * The base name of the action * @param enabled * Whether the action should be enabled */ - public I18nAction(String i18nName, boolean enabled) { - this(i18nName, enabled, null); + public I18nAction(I18n i18n, String i18nName, boolean enabled) { + this(i18n, i18nName, enabled, null); } /** * Creates a new action that uses the given name as base name to get values * from {@link I18n} and the given icon. * + * @param i18n + * The I18n container * @param i18nName * The base name of the action * @param enabled @@ -66,24 +73,24 @@ public abstract class I18nAction extends AbstractAction implements I18nable { * @param icon * The icon for the action */ - public I18nAction(String i18nName, boolean enabled, Icon icon) { + public I18nAction(I18n i18n, String i18nName, boolean enabled, Icon icon) { this.i18nName = i18nName; if (icon != null) { putValue(Action.SMALL_ICON, icon); } setEnabled(enabled); - updateI18n(); + updateI18n(i18n); } /** * {@inheritDoc} */ - public void updateI18n() { - putValue(Action.NAME, I18n.get(i18nName + ".name")); - putValue(Action.MNEMONIC_KEY, I18n.getKey(i18nName + ".mnemonic")); - putValue(Action.ACCELERATOR_KEY, I18n.getKeyStroke(i18nName + ".accelerator")); - putValue(Action.SHORT_DESCRIPTION, I18n.get(i18nName + ".shortDescription")); - putValue(Action.LONG_DESCRIPTION, I18n.get(i18nName + ".longDescription")); + public void updateI18n(I18n i18n) { + putValue(Action.NAME, i18n.get(i18nName + ".name")); + putValue(Action.MNEMONIC_KEY, i18n.getKey(i18nName + ".mnemonic")); + putValue(Action.ACCELERATOR_KEY, i18n.getKeyStroke(i18nName + ".accelerator")); + putValue(Action.SHORT_DESCRIPTION, i18n.get(i18nName + ".shortDescription")); + putValue(Action.LONG_DESCRIPTION, i18n.get(i18nName + ".longDescription")); } -} \ No newline at end of file +}