Index: trunk/src/org/openstreetmap/josm/data/projection/ProjectionSubPrefs.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/ProjectionSubPrefs.java	(revision 2498)
+++ trunk/src/org/openstreetmap/josm/data/projection/ProjectionSubPrefs.java	(revision 2499)
@@ -23,10 +23,10 @@
      * @return
      */
-    public JPanel getPreferencePanel();
+    public void setupPreferencePanel(JPanel p);
 
     /**
      * Will be called if the preference dialog is dismissed.
      */
-    public Collection<String> getPreferences();
+    public Collection<String> getPreferences(JPanel p);
 
     /**
@@ -40,9 +40,3 @@
      */
     public void setPreferences(Collection<String> args);
-
-    /**
-     * Resets all variables related to the projection preferences so they may
-     * update the next time getPreferencePanel is called.
-     */
-    public void destroyCachedPanel();
 }
Index: trunk/src/org/openstreetmap/josm/data/projection/UTM.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/UTM.java	(revision 2498)
+++ trunk/src/org/openstreetmap/josm/data/projection/UTM.java	(revision 2499)
@@ -377,11 +377,6 @@
     }
 
-    private JPanel prefpanel = null;
-    private JComboBox prefcb = null;
-    public JPanel getPreferencePanel() {
-        if(prefpanel != null)
-            return prefpanel;
-
-        prefcb = new JComboBox();
+    public void setupPreferencePanel(JPanel p) {
+        JComboBox prefcb = new JComboBox();
         for(int i = 1; i <= 60; i++) {
             prefcb.addItem(i);
@@ -389,22 +384,18 @@
 
         prefcb.setSelectedIndex(zone - 1);
-        prefpanel = new JPanel(new GridBagLayout());
-        prefpanel.add(new JLabel(tr("UTM Zone")), GBC.std().insets(5,5,0,5));
-        prefpanel.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL));
-        prefpanel.add(prefcb, GBC.eop().fill(GBC.HORIZONTAL));
-        prefpanel.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH));
-        return prefpanel;
-    }
-
-    public Collection<String> getPreferences() {
-        if(prefcb == null)
+        p.setLayout(new GridBagLayout());
+        p.add(new JLabel(tr("UTM Zone")), GBC.std().insets(5,5,0,5));
+        p.add(GBC.glue(1, 0), GBC.std().fill(GBC.HORIZONTAL));
+        /* Note: we use component position 2 below to find this again */
+        p.add(prefcb, GBC.eop().fill(GBC.HORIZONTAL));
+        p.add(GBC.glue(1, 1), GBC.eol().fill(GBC.BOTH));
+    }
+
+    public Collection<String> getPreferences(JPanel p) {
+        Object prefcb = p.getComponent(2);
+        if(!(prefcb instanceof JComboBox))
             return null;
-        int zone = prefcb.getSelectedIndex() + 1;
+        int zone = ((JComboBox)prefcb).getSelectedIndex() + 1;
         return Collections.singleton(Integer.toString(zone));
-    }
-
-    public void destroyCachedPanel() {
-        prefpanel = null;
-        prefcb = null;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 2498)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java	(revision 2499)
@@ -66,5 +66,4 @@
 
     public void addGui(PreferenceDialog gui) {
-        clearSubProjPrefs();
         setupProjectionCombo();
 
@@ -112,5 +111,5 @@
         Collection<String> prefs = null;
         if(projHasPrefs(proj))
-            prefs = ((ProjectionSubPrefs) proj).getPreferences();
+            prefs = ((ProjectionSubPrefs) proj).getPreferences(projSubPrefPanel);
 
         Main.pref.put("projection", projname);
@@ -121,9 +120,4 @@
             CoordinateFormat.setCoordinateFormat((CoordinateFormat)coordinatesCombo.getSelectedItem());
         }
-
-        // We get the change to remove these panels on closing the preferences
-        // dialog, so take it. TODO: Make this work always, even when canceling
-        // the dialog
-        clearSubProjPrefs();
 
         return false;
@@ -182,4 +176,21 @@
     }
 
+    private class SBPanel extends JPanel
+    {
+        private Projection p;
+        public SBPanel(Projection pr)
+        {
+          super();
+          p = pr;
+        }
+        @Override
+        public void paint(java.awt.Graphics g)
+        {
+          super.paint(g);
+          ((ProjectionSubPrefs) p).setPreferences(((ProjectionSubPrefs) p).getPreferences(this));
+          updateMeta(p);
+        }
+    };
+
     /**
      * Handles all the work related to update the projection-specific
@@ -192,5 +203,6 @@
         } else {
             ProjectionSubPrefs projPref = (ProjectionSubPrefs) proj;
-            projSubPrefPanel = projPref.getPreferencePanel();
+            projSubPrefPanel = new SBPanel(proj);
+            projPref.setupPreferencePanel(projSubPrefPanel);
         }
 
@@ -233,17 +245,3 @@
         });
     }
-
-    /**
-     * Method to clean up the preference panels made by each projection. This
-     * requires them to be regenerated when the prefs dialog is opened again,
-     * but this also makes them react to changes to their preferences from the
-     * outside
-     */
-    static private void clearSubProjPrefs() {
-        for(Projection proj : Projection.allProjections) {
-            if(projHasPrefs(proj)) {
-                ((ProjectionSubPrefs) proj).destroyCachedPanel();
-            }
-        }
-    }
 }
