Index: trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 429)
+++ trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 431)
@@ -12,4 +12,5 @@
 import java.io.StringReader;
 import java.net.HttpURLConnection;
+import java.net.URLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -46,6 +47,6 @@
 			try {
 				System.out.println("reading preferences from "+serverUrl);
-				HttpURLConnection con = (HttpURLConnection)serverUrl.openConnection();
-				addAuth(con);
+				URLConnection con = serverUrl.openConnection();
+				if (con instanceof HttpURLConnection) addAuth((HttpURLConnection) con);
 				con.connect();
 				BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
@@ -55,5 +56,5 @@
 					b.append("\n");
 				}
-				con.disconnect();
+				if (con instanceof HttpURLConnection) ((HttpURLConnection) con).disconnect();
 				return b.toString();
 			} catch (IOException e) {
@@ -122,5 +123,7 @@
 		if (!properties.containsKey("osm-server.password") && password != null)
 			properties.put("osm-server.password", password);
-		Reader in = new StringReader(connection.download());
+		String cont = connection.download();
+		if (cont == null) return;
+		Reader in = new StringReader(cont);
 		try {
 			XmlObjectParser.Uniform<Prop> parser = new XmlObjectParser.Uniform<Prop>(in, "tag", Prop.class);
@@ -176,4 +179,6 @@
 		} catch (MalformedURLException e) {
 			e.printStackTrace();
+		} catch (IllegalArgumentException e) {
+			e.printStackTrace();
 		} catch (IOException e) {
 			e.printStackTrace();
Index: trunk/src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 429)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplet.java	(revision 431)
@@ -4,7 +4,11 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
+import java.applet.AppletStub;
+import java.applet.AppletContext;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+import java.io.File;
+import java.net.URL;
 import java.util.Arrays;
 import java.util.Collection;
@@ -14,4 +18,5 @@
 
 import javax.swing.JApplet;
+import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -55,5 +60,4 @@
 
 	private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>();
-	private UploadPreferencesAction uploadPreferences = new UploadPreferencesAction(); 
 
 	@Override public String[][] getParameterInfo() {
@@ -101,5 +105,5 @@
 		// remove offending stuff from JOSM (that would break the SecurityManager)
 		m.remove(m.fileMenu);
-		m.editMenu.add(uploadPreferences);
+		m.editMenu.add(new UploadPreferencesAction());
 		m.open.setEnabled(false);
 		m.exit.setEnabled(false);
@@ -118,3 +122,42 @@
 		return v;
 	}
+
+	public static void main(String[] args) {
+		final JFrame frame = new JFrame("Java OpenStreetMap Applet");
+		MainApplet applet = new MainApplet();
+		applet.setStub(new AppletStub() {
+			public void appletResize(int w, int h) {
+				frame.resize(w, h);
+			}
+
+			public AppletContext getAppletContext() {
+				return null;
+			}
+
+			public URL getCodeBase() {
+				try {
+					return new File(".").toURI().toURL();
+				} catch (Exception e) {
+					e.printStackTrace();
+					return null;
+				}
+			}
+
+			public URL getDocumentBase() {
+				return getCodeBase();
+			}
+
+			public String getParameter(String k) {
+				return null;
+			}
+
+			public boolean isActive() {
+				return true;
+			}
+		});
+		applet.init();
+		applet.start();
+		frame.setContentPane(applet);
+		frame.setVisible(true);
+	}
 }
Index: trunk/src/org/openstreetmap/josm/gui/MapFrame.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 429)
+++ trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 431)
@@ -101,6 +101,5 @@
 
 		// status line below the map
-		if (!Main.applet)
-	        statusLine = new MapStatus(this);
+		statusLine = new MapStatus(this);
 	}
 
Index: trunk/src/org/openstreetmap/josm/gui/MapStatus.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapStatus.java	(revision 429)
+++ trunk/src/org/openstreetmap/josm/gui/MapStatus.java	(revision 431)
@@ -17,4 +17,6 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseMotionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.lang.reflect.InvocationTargetException;
 import java.text.DecimalFormat;
@@ -270,14 +272,43 @@
 		// Listen to keyboard/mouse events for pressing/releasing alt key and
 		// inform the collector.
-        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){
-        	public void eventDispatched(AWTEvent event) {
-        		synchronized (collector) {
-        			mouseState.modifiers = ((InputEvent)event).getModifiersEx();
-        			if (event instanceof MouseEvent)
-        				mouseState.mousePos = ((MouseEvent)event).getPoint();
-        			collector.notify();
-        		}
-        	}
-        }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
+		try {
+			Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){
+				public void eventDispatched(AWTEvent event) {
+					synchronized (collector) {
+						mouseState.modifiers = ((InputEvent)event).getModifiersEx();
+						if (event instanceof MouseEvent)
+							mouseState.mousePos = ((MouseEvent)event).getPoint();
+						collector.notify();
+					}
+				}
+			}, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
+		} catch (SecurityException ex) {
+			mapFrame.mapView.addMouseMotionListener(new MouseMotionListener() {
+				public void mouseMoved(MouseEvent e) {
+					synchronized (collector) {
+						mouseState.modifiers = e.getModifiersEx();
+						mouseState.mousePos = e.getPoint();
+						collector.notify();
+					}
+				}
+
+				public void mouseDragged(MouseEvent e) {
+					mouseMoved(e);
+				}
+			});
+
+			mapFrame.mapView.addKeyListener(new KeyAdapter() {
+				public void keyPressed(KeyEvent e) {
+					synchronized (collector) {
+						mouseState.modifiers = e.getModifiersEx();
+						collector.notify();
+					}
+				}
+
+				public void keyReleased(KeyEvent e) {
+					keyReleased(e);
+				}
+			});
+		}
 	}
 
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 429)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 431)
@@ -167,5 +167,9 @@
 
 	static {
-		sources.add(ClassLoader.getSystemClassLoader());
+		try {
+			sources.add(ClassLoader.getSystemClassLoader());
+		} catch (SecurityException ex) {
+			sources.add(ImageProvider.class.getClassLoader());
+		}
 	}
 }
