whitespace fixups
[jSite2.git] / src / net / pterodactylus / jsite / i18n / gui / I18nLabel.java
index f39b254..10dbfac 100644 (file)
@@ -28,9 +28,8 @@ import net.pterodactylus.jsite.i18n.I18nable;
 
 /**
  * Label that can update itself from {@link I18n}.
- * 
+ *
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public class I18nLabel extends JLabel implements I18nable {
 
@@ -42,7 +41,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 +52,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 +67,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 +81,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 +96,10 @@ public class I18nLabel extends JLabel implements I18nable {
                super();
                this.i18nBasename = i18nBasename;
                this.arguments = arguments;
-               updateI18n();
                if (component != null) {
                        setLabelFor(component);
                }
+               updateI18n();
        }
 
        /**
@@ -108,7 +107,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"));
+               }
        }
 
 }