[Schmitzm-commits] r1293 - trunk/src/skrueger/i8n

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 22 12:55:03 CET 2010


Author: keeb
Date: 2010-11-22 12:55:02 +0100 (Mon, 22 Nov 2010)
New Revision: 1293

Modified:
   trunk/src/skrueger/i8n/SwitchLanguageDialog.java
Log:
Fixed regression where OkButton could not be set as disabled/enabled

Modified: trunk/src/skrueger/i8n/SwitchLanguageDialog.java
===================================================================
--- trunk/src/skrueger/i8n/SwitchLanguageDialog.java	2010-11-22 10:39:13 UTC (rev 1292)
+++ trunk/src/skrueger/i8n/SwitchLanguageDialog.java	2010-11-22 11:55:02 UTC (rev 1293)
@@ -69,6 +69,8 @@
     private JPanel jPanel = null;
 
     private JLabel jLabel = null;
+    
+    private JButton jButton = null;
 
     private LanguagesComboBox jComboBox = null;
 
@@ -159,13 +161,33 @@
             jContentPane.setLayout(migLayout);
             jContentPane.add(jLabelFlagimage, "north");
             jContentPane.add(getLanguageCombobox());
-            jContentPane.add(getOkButton(), // AtlasDialog.getOkButton()
+            jContentPane.add(getJButton(), // AtlasDialog.getOkButton()
                     "right, w 50!, gaptop 5, gapright 5, gapbottom 5");
         }
         return jContentPane;
     }
+    
+    /**
+	 * This method initializes the OkButton
+	 * 
+	 * @return javax.swing.JButton
+	 */
+	private JButton getJButton() {
+		if (jButton == null) {
+			jButton = new OkButton();
+			jButton.setEnabled(false);
 
-    /**
+			jButton.addActionListener(new ActionListener() {
+
+				public void actionPerformed(ActionEvent e) {
+					dispose();
+				}
+
+			});
+		}
+		return jButton;
+	}
+	/**
      * This method initializes the JPanel that carries the select language
      * combobox
      * 
@@ -201,7 +223,7 @@
 
                 public void actionPerformed(final ActionEvent e) {
                     if (jComboBox.getSelectedIndex() == languages.size()) {
-                        getOkButton().setEnabled(false);
+                        getJButton().setEnabled(false);
                         return;
                     }
 
@@ -209,10 +231,10 @@
                     try {
                         Translation.setActiveLang(l, setLocale);
 
-                        getOkButton().setEnabled(true);
+                        getJButton().setEnabled(true);
                     } catch (java.lang.IllegalArgumentException ee) {
                         LOGGER.warn("The language " + l + " is not valid", ee);
-                        getOkButton().setEnabled(false);
+                        getJButton().setEnabled(false);
                     }
 
                 }



More information about the Schmitzm-commits mailing list