From 9d28409e5199f1dfbe83a08eda4474a599bf8484 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 3 May 2008 14:51:31 +0000 Subject: [PATCH] set mnemonic only if label is for a component git-svn-id: http://trooper/svn/projects/jSite/trunk@776 c3eda9e8-030b-0410-8277-bc7414b0a119 --- src/net/pterodactylus/jsite/i18n/gui/I18nLabel.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/net/pterodactylus/jsite/i18n/gui/I18nLabel.java b/src/net/pterodactylus/jsite/i18n/gui/I18nLabel.java index f39b254..ac56926 100644 --- a/src/net/pterodactylus/jsite/i18n/gui/I18nLabel.java +++ b/src/net/pterodactylus/jsite/i18n/gui/I18nLabel.java @@ -28,7 +28,7 @@ import net.pterodactylus.jsite.i18n.I18nable; /** * Label that can update itself from {@link I18n}. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ @@ -42,7 +42,7 @@ public class I18nLabel extends JLabel implements I18nable { /** * Creates a new label with the given I18n basename. - * + * * @param i18nBasename * The I18n basename of the label */ @@ -53,7 +53,7 @@ public class I18nLabel extends JLabel implements I18nable { /** * Creates a new label with the given I18n basename that optionally is a * label for the given component. - * + * * @param i18nBasename * The I18n basename of the label * @param component @@ -68,7 +68,7 @@ public class I18nLabel extends JLabel implements I18nable { /** * Creates a new label with the given I18n basename that optionally is a * label for the given component. - * + * * @param i18nBasename * The I18n basename of the label * @param arguments @@ -82,7 +82,7 @@ public class I18nLabel extends JLabel implements I18nable { /** * Creates a new label with the given I18n basename that optionally is a * label for the given component. - * + * * @param i18nBasename * The I18n basename of the label * @param component @@ -97,10 +97,10 @@ public class I18nLabel extends JLabel implements I18nable { super(); this.i18nBasename = i18nBasename; this.arguments = arguments; - updateI18n(); if (component != null) { setLabelFor(component); } + updateI18n(); } /** @@ -108,7 +108,9 @@ public class I18nLabel extends JLabel implements I18nable { */ public void updateI18n() { setText(I18n.get(i18nBasename + ".name", arguments)); - setDisplayedMnemonic(I18n.getKey(i18nBasename + ".mnemonic")); + if (getLabelFor() != null) { + setDisplayedMnemonic(I18n.getKey(i18nBasename + ".mnemonic")); + } } } -- 2.7.4