Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 10441)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 10442)
@@ -596,5 +596,5 @@
     public Main() {
         main = this;
-        mainPanel.addAndFireMapFrameListener(new MapFrameListener() {
+        mainPanel.addMapFrameListener(new MapFrameListener() {
             @Override
             public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
Index: /trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 10441)
+++ /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 10442)
@@ -317,4 +317,83 @@
         initApplicationPreferences();
 
+        Policy.setPolicy(new Policy() {
+            // Permissions for plug-ins loaded when josm is started via webstart
+            private PermissionCollection pc;
+
+            {
+                pc = new Permissions();
+                pc.add(new AllPermission());
+            }
+
+            @Override
+            public PermissionCollection getPermissions(CodeSource codesource) {
+                return pc;
+            }
+        });
+
+        Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
+
+        // initialize the platform hook, and
+        Main.determinePlatformHook();
+        // call the really early hook before we do anything else
+        Main.platform.preStartupHook();
+
+        Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));
+
+        if (args.containsKey(Option.VERSION)) {
+            System.out.println(Version.getInstance().getAgentString());
+            System.exit(0);
+        }
+
+        if (args.containsKey(Option.DEBUG) || args.containsKey(Option.TRACE)) {
+            // Enable JOSM debug level
+            logLevel = 4;
+            Main.info(tr("Printing debugging messages to console"));
+        }
+
+        boolean skipLoadingPlugins = false;
+        if (args.containsKey(Option.SKIP_PLUGINS)) {
+            skipLoadingPlugins = true;
+            Main.info(tr("Plugin loading skipped"));
+        }
+
+        if (args.containsKey(Option.TRACE)) {
+            // Enable JOSM debug level
+            logLevel = 5;
+            // Enable debug in OAuth signpost via system preference, but only at trace level
+            Utils.updateSystemProperty("debug", "true");
+            Main.info(tr("Enabled detailed debug level (trace)"));
+        }
+
+        Main.pref.init(args.containsKey(Option.RESET_PREFERENCES));
+
+        if (args.containsKey(Option.SET)) {
+            for (String i : args.get(Option.SET)) {
+                String[] kv = i.split("=", 2);
+                Main.pref.put(kv[0], "null".equals(kv[1]) ? null : kv[1]);
+            }
+        }
+
+        if (!languageGiven) {
+            I18n.set(Main.pref.get("language", null));
+        }
+        Main.pref.updateSystemProperties();
+
+        checkIPv6();
+
+        // asking for help? show help and exit
+        if (args.containsKey(Option.HELP)) {
+            showHelp();
+            System.exit(0);
+        }
+
+        processOffline(args);
+
+        Main.platform.afterPrefStartupHook();
+
+        FontsManager.initialize();
+
+        I18n.setupLanguageFonts();
+
         // Can only be called after preferences are initialized.
         // We can move this to MainPanel constructor as soon as noone depends on Main#panel any more.
@@ -325,83 +404,4 @@
             }
         });
-
-        Policy.setPolicy(new Policy() {
-            // Permissions for plug-ins loaded when josm is started via webstart
-            private PermissionCollection pc;
-
-            {
-                pc = new Permissions();
-                pc.add(new AllPermission());
-            }
-
-            @Override
-            public PermissionCollection getPermissions(CodeSource codesource) {
-                return pc;
-            }
-        });
-
-        Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler());
-
-        // initialize the platform hook, and
-        Main.determinePlatformHook();
-        // call the really early hook before we do anything else
-        Main.platform.preStartupHook();
-
-        Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));
-
-        if (args.containsKey(Option.VERSION)) {
-            System.out.println(Version.getInstance().getAgentString());
-            System.exit(0);
-        }
-
-        if (args.containsKey(Option.DEBUG) || args.containsKey(Option.TRACE)) {
-            // Enable JOSM debug level
-            logLevel = 4;
-            Main.info(tr("Printing debugging messages to console"));
-        }
-
-        boolean skipLoadingPlugins = false;
-        if (args.containsKey(Option.SKIP_PLUGINS)) {
-            skipLoadingPlugins = true;
-            Main.info(tr("Plugin loading skipped"));
-        }
-
-        if (args.containsKey(Option.TRACE)) {
-            // Enable JOSM debug level
-            logLevel = 5;
-            // Enable debug in OAuth signpost via system preference, but only at trace level
-            Utils.updateSystemProperty("debug", "true");
-            Main.info(tr("Enabled detailed debug level (trace)"));
-        }
-
-        Main.pref.init(args.containsKey(Option.RESET_PREFERENCES));
-
-        if (args.containsKey(Option.SET)) {
-            for (String i : args.get(Option.SET)) {
-                String[] kv = i.split("=", 2);
-                Main.pref.put(kv[0], "null".equals(kv[1]) ? null : kv[1]);
-            }
-        }
-
-        if (!languageGiven) {
-            I18n.set(Main.pref.get("language", null));
-        }
-        Main.pref.updateSystemProperties();
-
-        checkIPv6();
-
-        // asking for help? show help and exit
-        if (args.containsKey(Option.HELP)) {
-            showHelp();
-            System.exit(0);
-        }
-
-        processOffline(args);
-
-        Main.platform.afterPrefStartupHook();
-
-        FontsManager.initialize();
-
-        I18n.setupLanguageFonts();
 
         WindowGeometry geometry = WindowGeometry.mainWindow("gui.geometry",
