Index: src/org/openstreetmap/josm/Main.java
===================================================================
--- src/org/openstreetmap/josm/Main.java	(revision 171)
+++ src/org/openstreetmap/josm/Main.java	(revision 172)
@@ -23,5 +23,4 @@
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
-import javax.swing.JToolBar;
 import javax.swing.KeyStroke;
 import javax.swing.UIManager;
@@ -44,4 +43,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
+import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
 import org.openstreetmap.josm.plugins.PluginException;
 import org.openstreetmap.josm.plugins.PluginInformation;
@@ -88,4 +88,14 @@
 	 */
 	public static PleaseWaitDialog pleaseWaitDlg;
+
+	/**
+	 * True, when in applet mode
+	 */
+	public static boolean applet = false;
+
+	/**
+	 * The toolbar preference control to register new actions.
+	 */
+	public static ToolbarPreferences toolbar = new ToolbarPreferences();
 
 
@@ -163,24 +173,13 @@
 
 		// creating toolbar
-		final JToolBar toolBar = new JToolBar();
-		toolBar.setFloatable(false);
-		toolBar.add(menu.download);
-		toolBar.add(menu.upload);
-		toolBar.addSeparator();
-		toolBar.add(menu.newAction);
-		toolBar.add(menu.open);
-		toolBar.add(menu.save);
-		toolBar.add(menu.gpxExport);
-		toolBar.addSeparator();
-		toolBar.add(menu.undo);
-		toolBar.add(menu.redo);
-		toolBar.addSeparator();
-		toolBar.add(menu.preferences);
-		contentPane.add(toolBar, BorderLayout.NORTH);
+		contentPane.add(toolbar.control, BorderLayout.NORTH);
 
         contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "Help");
         contentPane.getActionMap().put("Help", menu.help);
 
-		contentPane.updateUI();
+        toolbar.refreshToolbarControl();
+
+        toolbar.control.updateUI();
+        contentPane.updateUI();
 	}
 
@@ -247,5 +246,4 @@
 
 	protected static Rectangle bounds;
-
 
 	private final CommandQueueListener redoUndoListener = new CommandQueueListener(){
@@ -346,5 +344,5 @@
 	    return false;
     }
-	
+
 	private static void downloadFromParamString(final boolean rawGps, String s) {
 		if (s.startsWith("http:")) {
Index: src/org/openstreetmap/josm/actions/DownloadAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/DownloadAction.java	(revision 171)
+++ src/org/openstreetmap/josm/actions/DownloadAction.java	(revision 172)
@@ -35,9 +35,9 @@
 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.gui.BookmarkList;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.WorldChooser;
-import org.openstreetmap.josm.gui.BookmarkList.Bookmark;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -184,5 +184,5 @@
 		bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
 			public void valueChanged(ListSelectionEvent e) {
-				Bookmark b = (Bookmark)bookmarks.getSelectedValue();
+				Preferences.Bookmark b = (Preferences.Bookmark)bookmarks.getSelectedValue();
 				for (int i = 0; i < 4; ++i) {
 					latlon[i].setText(b == null ? "" : ""+b.latlon[i]);
@@ -199,5 +199,5 @@
 		add.addActionListener(new ActionListener(){
 			public void actionPerformed(ActionEvent e) {
-				Bookmark b = readBookmark();
+				Preferences.Bookmark b = readBookmark();
 				if (b == null) {
 					JOptionPane.showMessageDialog(Main.parent, tr("Please enter the desired coordinates first."));
@@ -232,5 +232,5 @@
 
 		// Finally: the dialog
-		Bookmark b;
+		Preferences.Bookmark b;
 		boolean anySelected = false;
 		do {
@@ -278,7 +278,7 @@
 	 * 		checkbox.
 	 */
-	Bookmark readBookmark() {
+	Preferences.Bookmark readBookmark() {
 		try {
-			Bookmark b = new Bookmark();
+			Preferences.Bookmark b = new Preferences.Bookmark();
 			for (int i = 0; i < 4; ++i) {
 				if (latlon[i].getText().equals(""))
Index: src/org/openstreetmap/josm/actions/JosmAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/JosmAction.java	(revision 171)
+++ src/org/openstreetmap/josm/actions/JosmAction.java	(revision 172)
@@ -28,4 +28,6 @@
 		putValue(SHORT_DESCRIPTION, tooltip);
 		putValue(MNEMONIC_KEY, mnemonic);
+		putValue("toolbar", iconName);
+		Main.toolbar.register(this);
 	}
 
@@ -37,4 +39,6 @@
         Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, modifier), name);
         Main.contentPane.getActionMap().put(name, this);
+        putValue("toolbar", iconName);
+        Main.toolbar.register(this);
 	}
 
Index: src/org/openstreetmap/josm/actions/NewAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/NewAction.java	(revision 171)
+++ src/org/openstreetmap/josm/actions/NewAction.java	(revision 172)
@@ -4,4 +4,5 @@
 
 import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 
@@ -10,7 +11,6 @@
 public class NewAction extends JosmAction {
 
-
 	public NewAction() {
-		super(tr("New"), "new", tr("Create a new map."), KeyEvent.VK_N);
+		super(tr("New"), "new", tr("Create a new map."), KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK);
 	}
 
Index: src/org/openstreetmap/josm/actions/RenameLayerAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/RenameLayerAction.java	(revision 171)
+++ src/org/openstreetmap/josm/actions/RenameLayerAction.java	(revision 172)
@@ -43,6 +43,11 @@
 		panel.add(name);
 		JCheckBox filerename = new JCheckBox(tr("Also rename the file"));
-		panel.add(filerename);
-		filerename.setEnabled(file != null);
+		if (Main.applet) {
+			filerename.setEnabled(false);
+			filerename.setSelected(false);
+		} else {
+			panel.add(filerename);
+			filerename.setEnabled(file != null);
+		}
 		if (filerename.isEnabled())
 			filerename.setSelected(Main.pref.getBoolean("layer.rename-file", true));
Index: src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- src/org/openstreetmap/josm/data/Preferences.java	(revision 171)
+++ src/org/openstreetmap/josm/data/Preferences.java	(revision 172)
@@ -5,4 +5,5 @@
 import java.awt.Color;
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
@@ -10,9 +11,13 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.SortedMap;
+import java.util.StringTokenizer;
 import java.util.TreeMap;
 import java.util.Map.Entry;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor;
 import org.openstreetmap.josm.tools.ColorHelper;
@@ -33,4 +38,16 @@
 	}
 
+	/**
+	 * Class holding one bookmarkentry.
+	 * @author imi
+	 */
+	public static class Bookmark {
+		public String name;
+		public double[] latlon = new double[4]; // minlat, minlon, maxlat, maxlon
+		@Override public String toString() {
+			return name;
+		}
+	}
+
 	public final ArrayList<PreferenceChangedListener> listener = new ArrayList<PreferenceChangedListener>();
 
@@ -90,9 +107,9 @@
 	}
 
+
 	private final void firePreferenceChanged(final String key, final String value) {
 		for (final PreferenceChangedListener l : listener)
 			l.preferenceChanged(key, value);
 	}
-
 
 	/**
@@ -148,3 +165,43 @@
 			properties.put("color.scale", ColorHelper.color2html(Color.white));
 	}
+
+	public Collection<Bookmark> loadBookmarks() throws IOException {
+		File bookmarkFile = new File(getPreferencesDir()+"bookmarks");
+		if (!bookmarkFile.exists())
+			bookmarkFile.createNewFile();
+		BufferedReader in = new BufferedReader(new FileReader(bookmarkFile));
+
+		Collection<Bookmark> bookmarks = new LinkedList<Bookmark>();
+		for (String line = in.readLine(); line != null; line = in.readLine()) {
+			StringTokenizer st = new StringTokenizer(line, ",");
+			if (st.countTokens() < 5)
+				continue;
+			Bookmark b = new Bookmark();
+			b.name = st.nextToken();
+			try {
+				for (int i = 0; i < b.latlon.length; ++i)
+					b.latlon[i] = Double.parseDouble(st.nextToken());
+				bookmarks.add(b);
+			} catch (NumberFormatException x) {
+				// line not parsed
+			}
+		}
+		in.close();
+		return bookmarks;
+	}
+
+	public void saveBookmarks(Collection<Bookmark> bookmarks) throws IOException {
+		File bookmarkFile = new File(Main.pref.getPreferencesDir()+"bookmarks");
+		if (!bookmarkFile.exists())
+			bookmarkFile.createNewFile();
+		PrintWriter out = new PrintWriter(new FileWriter(bookmarkFile));
+		for (Bookmark b : bookmarks) {
+			b.name.replace(',', '_');
+			out.print(b.name+",");
+			for (int i = 0; i < b.latlon.length; ++i)
+				out.print(b.latlon[i]+(i<b.latlon.length-1?",":""));
+			out.println();
+		}
+		out.close();
+	}
 }
Index: src/org/openstreetmap/josm/data/ServerSidePreferences.java
===================================================================
--- src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 171)
+++ src/org/openstreetmap/josm/data/ServerSidePreferences.java	(revision 172)
@@ -2,4 +2,6 @@
 
 import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
 
 /**
@@ -17,4 +19,5 @@
 		this.serverUrl = serverUrl;
 		this.userName = userName;
+		load();
     }
 	
@@ -29,3 +32,10 @@
 	@Override protected void save() {
     }
+
+	@Override public Collection<Bookmark> loadBookmarks() {
+		return Collections.<Bookmark>emptyList();
+    }
+
+	@Override public void saveBookmarks(Collection<Bookmark> bookmarks) {
+    }
 }
Index: src/org/openstreetmap/josm/gui/BookmarkList.java
===================================================================
--- src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/BookmarkList.java	(revision 172)
@@ -3,11 +3,7 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.StringTokenizer;
+import java.util.Collection;
+import java.util.LinkedList;
 
 import javax.swing.DefaultListModel;
@@ -16,4 +12,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 
 /**
@@ -22,16 +19,4 @@
  */
 public class BookmarkList extends JList {
-
-	/**
-	 * Class holding one bookmarkentry.
-	 * @author imi
-	 */
-	public static class Bookmark {
-		public String name;
-		public double[] latlon = new double[4]; // minlat, minlon, maxlat, maxlon
-		@Override public String toString() {
-			return name;
-		}
-	}
 
 	/**
@@ -50,26 +35,9 @@
 		DefaultListModel model = (DefaultListModel)getModel();
 		model.removeAllElements();
-		File bookmarkFile = new File(Main.pref.getPreferencesDir()+"bookmarks");
 		try {
-			if (!bookmarkFile.exists())
-				bookmarkFile.createNewFile();
-			BufferedReader in = new BufferedReader(new FileReader(bookmarkFile));
-
-			for (String line = in.readLine(); line != null; line = in.readLine()) {
-				StringTokenizer st = new StringTokenizer(line, ",");
-				if (st.countTokens() < 5)
-					continue;
-				Bookmark b = new Bookmark();
-				b.name = st.nextToken();
-				try {
-					for (int i = 0; i < b.latlon.length; ++i)
-						b.latlon[i] = Double.parseDouble(st.nextToken());
-					model.addElement(b);
-				} catch (NumberFormatException x) {
-					// line not parsed
-				}
-			}
-			in.close();
+			for (Preferences.Bookmark b : Main.pref.loadBookmarks())
+				model.addElement(b);
 		} catch (IOException e) {
+			e.printStackTrace();
 			JOptionPane.showMessageDialog(Main.parent, tr("Could not read bookmarks.")+"\n"+e.getMessage());
 		}
@@ -80,19 +48,9 @@
 	 */
 	public void save() {
-		File bookmarkFile = new File(Main.pref.getPreferencesDir()+"bookmarks");
 		try {
-			if (!bookmarkFile.exists())
-				bookmarkFile.createNewFile();
-			PrintWriter out = new PrintWriter(new FileWriter(bookmarkFile));
-			DefaultListModel m = (DefaultListModel)getModel();
-			for (Object o : m.toArray()) {
-				Bookmark b = (Bookmark)o;
-				b.name.replace(',', '_');
-				out.print(b.name+",");
-				for (int i = 0; i < b.latlon.length; ++i)
-					out.print(b.latlon[i]+(i<b.latlon.length-1?",":""));
-				out.println();
-			}
-			out.close();
+			Collection<Preferences.Bookmark> bookmarks = new LinkedList<Preferences.Bookmark>();
+			for (Object o : ((DefaultListModel)getModel()).toArray())
+				bookmarks.add((Preferences.Bookmark)o);
+			Main.pref.saveBookmarks(bookmarks);
 		} catch (IOException e) {
 			JOptionPane.showMessageDialog(Main.parent,tr("Could not write bookmark.")+"\n"+e.getMessage());
Index: src/org/openstreetmap/josm/gui/MainApplet.java
===================================================================
--- src/org/openstreetmap/josm/gui/MainApplet.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/MainApplet.java	(revision 172)
@@ -40,5 +40,5 @@
 		{"reset-preferences", tr("any"),tr("If specified, reset the configuration instead of reading it.")}
 	};
-	
+
 	private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 
 
@@ -75,10 +75,21 @@
 		}
 
+		Main.applet = true;
 		Main.pref = new ServerSidePreferences(getCodeBase(), username);
-		
+
 		Main.preConstructorInit(args);
 		Main.parent = this;
 		new MainCaller().postConstructorProcessCmdLine(args);
-    }
+		
+		MainMenu m = Main.main.menu; // shortcut
+
+		// remove offending stuff from JOSM (that would break the SecurityManager)
+		m.remove(m.fileMenu);
+		m.open.setEnabled(false);
+		m.exit.setEnabled(false);
+		m.save.setEnabled(false);
+		m.saveAs.setEnabled(false);
+		m.gpxExport.setEnabled(false);
+	}
 
 	private Collection<String> readParameter(String s, Collection<String> v) {
Index: src/org/openstreetmap/josm/gui/MapFrame.java
===================================================================
--- src/org/openstreetmap/josm/gui/MapFrame.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/MapFrame.java	(revision 172)
@@ -57,5 +57,5 @@
 	 * The status line below the map
 	 */
-	public MapStatus statusLine;
+	private MapStatus statusLine;
 
 	public ConflictDialog conflictDialog;
@@ -126,5 +126,6 @@
 
 		// status line below the map
-		statusLine = new MapStatus(this);
+		if (!Main.applet)
+	        statusLine = new MapStatus(this);
 	}
 
@@ -189,5 +190,6 @@
 		panel.add(this, BorderLayout.CENTER);
 		panel.add(toolBarActions, BorderLayout.WEST);
-		panel.add(statusLine, BorderLayout.SOUTH);
+		if (statusLine != null)
+			panel.add(statusLine, BorderLayout.SOUTH);
 	}
 }
Index: src/org/openstreetmap/josm/gui/MapStatus.java
===================================================================
--- src/org/openstreetmap/josm/gui/MapStatus.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/MapStatus.java	(revision 172)
@@ -232,14 +232,14 @@
 		// 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);
+        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);
 	}
 
Index: src/org/openstreetmap/josm/gui/WorldChooser.java
===================================================================
--- src/org/openstreetmap/josm/gui/WorldChooser.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/WorldChooser.java	(revision 172)
@@ -19,8 +19,8 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.projection.Projection;
-import org.openstreetmap.josm.gui.BookmarkList.Bookmark;
 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded;
 
@@ -136,5 +136,5 @@
 		list.addListSelectionListener(new ListSelectionListener(){
 			public void valueChanged(ListSelectionEvent e) {
-				Bookmark b = (Bookmark)list.getSelectedValue();
+				Preferences.Bookmark b = (Preferences.Bookmark)list.getSelectedValue();
 				if (b != null) {
 					markerMin = getProjection().latlon2eastNorth(new LatLon(b.latlon[0],b.latlon[1]));
Index: src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 172)
@@ -315,4 +315,13 @@
 
 	@Override public Component[] getMenuEntries() {
+		if (Main.applet) {
+			return new Component[]{
+					new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+					new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+					new JSeparator(),
+					new JMenuItem(new RenameLayerAction(associatedFile, this)),
+					new JSeparator(),
+					new JMenuItem(new LayerListPopup.InfoAction(this))};
+		}
 		return new Component[]{
 				new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
Index: src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
===================================================================
--- src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java	(revision 172)
@@ -56,5 +56,5 @@
 		public ConvertToDataLayerAction() {
 			super(tr("Convert to data layer"), ImageProvider.get("converttoosm"));
-        }
+		}
 		public void actionPerformed(ActionEvent e) {
 			DataSet ds = new DataSet();
@@ -76,6 +76,6 @@
 			Main.main.addLayer(new OsmDataLayer(ds, tr("Data Layer"), null));
 			Main.main.removeLayer(RawGpsLayer.this);
-        }
-    }
+		}
+	}
 
 	public static class GpsPoint {
@@ -89,5 +89,5 @@
 		}
 	}
-	
+
 	/**
 	 * A list of ways which containing a list of points.
@@ -109,5 +109,5 @@
 					}
 				});
-            }
+			}
 		});
 	}
@@ -130,5 +130,5 @@
 			g.setColor(Color.GRAY);
 		Point old = null;
-		
+
 		boolean force = Main.pref.getBoolean("draw.rawgps.lines.force");
 		boolean lines = Main.pref.getBoolean("draw.rawgps.lines");
@@ -240,5 +240,5 @@
 			}
 		});
-		
+
 		JMenuItem tagimage = new JMenuItem(tr("Import images"), ImageProvider.get("tagimages"));
 		tagimage.addActionListener(new ActionListener(){
@@ -264,5 +264,5 @@
 				Main.pref.put("tagimages.lastdirectory", fc.getCurrentDirectory().getPath());
 				GeoImageLayer.create(files, RawGpsLayer.this);
-            }
+			}
 
 			private void addRecursiveFiles(LinkedList<File> files, File[] sel) {
@@ -273,7 +273,19 @@
 						files.add(f);
 				}
-            }
+			}
 		});
-		
+
+		if (Main.applet)
+			return new Component[]{
+				new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+				new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+				new JSeparator(),
+				color,
+				line,
+				new JMenuItem(new ConvertToDataLayerAction()),
+				new JSeparator(),
+				new JMenuItem(new RenameLayerAction(associatedFile, this)),
+				new JSeparator(),
+				new JMenuItem(new LayerListPopup.InfoAction(this))};
 		return new Component[]{
 				new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
@@ -289,5 +301,5 @@
 				new JSeparator(),
 				new JMenuItem(new LayerListPopup.InfoAction(this))};
-    }
+	}
 
 	public void preferenceChanged(String key, String newValue) {
Index: src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 171)
+++ src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 172)
@@ -8,4 +8,5 @@
 import java.awt.event.ActionListener;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.LinkedList;
 
@@ -84,6 +85,11 @@
 	public PreferenceDialog() {
 		super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT);
-		for (PreferenceSetting setting : settings)
-			setting.addGui(this);
+		for (Iterator<PreferenceSetting> it = settings.iterator(); it.hasNext();) {
+			try {
+	            it.next().addGui(this);
+            } catch (SecurityException e) {
+            	it.remove();
+            }
+		}
 	}
 
@@ -98,4 +104,5 @@
 		settings.add(new AnnotationPresetPreference());
 		settings.add(new PluginPreference());
+		settings.add(Main.toolbar);
 		
 		for (PluginProxy plugin : Main.plugins) {
Index: src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 172)
+++ src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java	(revision 172)
@@ -0,0 +1,260 @@
+package org.openstreetmap.josm.gui.preferences;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.Action;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JToolBar;
+import javax.swing.ListCellRenderer;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+public class ToolbarPreferences implements PreferenceSetting {
+
+	private final class Move implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			if (e.getActionCommand().equals("<<")) {
+				while (unselected.size() > 1) {
+					selected.addElement(unselected.get(0));
+					unselected.remove(0);
+				}
+			} else if (e.getActionCommand().equals("<") && unselectedList.getSelectedIndex() != -1) {
+				while (unselectedList.getSelectedIndex() != -1 && unselectedList.getSelectedIndex() != unselected.size()-1) {
+					selected.addElement(unselectedList.getSelectedValue());
+					unselected.remove(unselectedList.getSelectedIndex());
+				}
+				if (unselectedList.getSelectedIndex() == unselected.size()-1)
+					selected.addElement(null);
+			} else if (e.getActionCommand().equals(">") && selectedList.getSelectedIndex() != -1) {
+				while (selectedList.getSelectedIndex() != -1) {
+					if (selectedList.getSelectedValue() != null)
+						unselected.add(unselected.size()-1, selectedList.getSelectedValue());
+					selected.remove(selectedList.getSelectedIndex());
+				}
+			} else if (e.getActionCommand().equals(">>")) {
+				while (selected.size() > 0) {
+					if (selected.get(0) != null)
+						unselected.add(unselected.size()-1, selected.get(0));
+					selected.remove(0);
+				}
+			} else if (e.getActionCommand().equals("up")) {
+				int i = selectedList.getSelectedIndex();
+				Object o = selected.get(i);
+				if (i != 0) {
+					selected.remove(i);
+					selected.add(i-1, o);
+					selectedList.setSelectedIndex(i-1);
+				}
+			} else if (e.getActionCommand().equals("down")) {
+				int i = selectedList.getSelectedIndex();
+				Object o = selected.get(i);
+				if (i != selected.size()-1) {
+					selected.remove(i);
+					selected.add(i+1, o);
+					selectedList.setSelectedIndex(i+1);
+				}
+			}
+		}
+	}
+	private Move moveAction = new Move();
+
+	private Map<String, Action> actions = new HashMap<String, Action>();
+
+	private DefaultListModel selected = new DefaultListModel();
+	private DefaultListModel unselected = new DefaultListModel();
+	private JList selectedList = new JList(selected);
+	private JList unselectedList = new JList(unselected);
+
+	public JToolBar control = new JToolBar();
+
+	private JButton upButton;
+	private JButton downButton;
+
+	public ToolbarPreferences() {
+		control.setFloatable(false);
+
+		final ListCellRenderer oldRenderer = selectedList.getCellRenderer();
+		ListCellRenderer renderer = new DefaultListCellRenderer(){
+			@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+				String s = tr("Separator");
+				Icon i = ImageProvider.get("preferences/separator");
+				if (value != null) {
+					s = (String)((Action)value).getValue(Action.NAME);
+					i = (Icon)((Action)value).getValue(Action.SMALL_ICON);
+				}
+				JLabel l = (JLabel)oldRenderer.getListCellRendererComponent(list, s, index, isSelected, cellHasFocus);
+				l.setIcon(i);
+				return l;
+			}
+		};
+		selectedList.setCellRenderer(renderer);
+		unselectedList.setCellRenderer(renderer);
+
+		unselectedList.addListSelectionListener(new ListSelectionListener(){
+			public void valueChanged(ListSelectionEvent e) {
+				if ((unselectedList.getSelectedIndex() != -1))
+					selectedList.clearSelection();
+				upButton.setEnabled(selectedList.getSelectedIndex() != -1);
+				downButton.setEnabled(selectedList.getSelectedIndex() != -1);
+			}
+		});
+		selectedList.addListSelectionListener(new ListSelectionListener(){
+			public void valueChanged(ListSelectionEvent e) {
+				boolean sel = selectedList.getSelectedIndex() != -1;
+				if (sel)
+					unselectedList.clearSelection();
+				upButton.setEnabled(sel);
+				downButton.setEnabled(sel);
+			}
+		});
+	}
+
+	public void addGui(PreferenceDialog gui) {
+		selected.removeAllElements();
+		unselected.removeAllElements();
+		for (Action a : actions.values())
+			unselected.addElement(a);
+		unselected.addElement(null);
+
+		final JPanel left = new JPanel(new GridBagLayout());
+		left.add(new JLabel("Toolbar"), GBC.eol());
+		left.add(new JScrollPane(selectedList), GBC.std().fill(GBC.BOTH));
+
+		final JPanel right = new JPanel(new GridBagLayout());
+		right.add(new JLabel("Available"), GBC.eol());
+		right.add(new JScrollPane(unselectedList), GBC.eol().fill(GBC.BOTH));
+
+		final JPanel buttons = new JPanel(new GridLayout(6,1));
+		buttons.add(upButton = createButton("up"));
+		buttons.add(createButton("<<"));
+		buttons.add(createButton("<"));
+		buttons.add(createButton(">"));
+		buttons.add(createButton(">>"));
+		buttons.add(downButton = createButton("down"));
+		upButton.setEnabled(false);
+		downButton.setEnabled(false);
+		
+		final JPanel p = new JPanel();
+		p.setLayout(new LayoutManager(){
+			public void addLayoutComponent(String name, Component comp) {}
+			public void removeLayoutComponent(Component comp) {}
+			public Dimension minimumLayoutSize(Container parent) {
+				Dimension l = left.getMinimumSize();
+				Dimension r = right.getMinimumSize();
+				Dimension b = buttons.getMinimumSize();
+				return new Dimension(l.width+b.width+10+r.width,l.height+b.height+10+r.height);
+			}
+			public Dimension preferredLayoutSize(Container parent) {
+				Dimension l = left.getPreferredSize();
+				Dimension r = right.getPreferredSize();
+				return new Dimension(l.width+r.width+10+buttons.getPreferredSize().width,Math.max(l.height, r.height));
+			}
+			public void layoutContainer(Container parent) {
+				Dimension d = p.getSize();
+				Dimension b = buttons.getPreferredSize();
+				int width = d.width/2-10-b.width;
+				left.setBounds(new Rectangle(0,0,width,d.height));
+				right.setBounds(new Rectangle(width+10+b.width,0,width,d.height));
+				buttons.setBounds(new Rectangle(width+5, d.height/2-b.height/2, b.width, b.height));
+			}
+		});
+		p.add(left);
+		p.add(buttons);
+		p.add(right);
+
+		JPanel panel = gui.createPreferenceTab("toolbar", "Toolbar customization", "Customize the elements on the toolbar.");
+		panel.add(p, GBC.eol().fill(GBC.BOTH));
+
+		for (String s : getToolString()) {
+			if (s.equals("|"))
+				selected.addElement(null);
+			else {
+				Action a = actions.get(s);
+				if (a != null) {
+					selected.addElement(a);
+					unselected.removeElement(a);
+				}
+			}
+		}
+	}
+
+	private String[] getToolString() {
+		String s = Main.pref.get("toolbar", "download;upload;|;new;open;save;exportgpx;|;undo;redo;|;preference");
+		if (s == null || s.equals("null") || s.equals(""))
+			return new String[0];
+		return s.split(";");
+	}
+
+	private JButton createButton(String name) {
+		JButton b = new JButton();
+		if (name.equals("up"))
+			b.setIcon(ImageProvider.get("dialogs", "up"));
+		else if (name.equals("down"))
+			b.setIcon(ImageProvider.get("dialogs", "down"));
+		else
+			b.setText(name);
+		b.addActionListener(moveAction);
+		b.setActionCommand(name);
+		return b;
+	}
+
+	public void ok() {
+		StringBuilder b = new StringBuilder();
+		for (int i = 0; i < selected.size(); ++i) {
+			if (selected.get(i) == null)
+				b.append("|");
+			else
+				b.append(((Action)selected.get(i)).getValue("toolbar"));
+			b.append(";");
+		}
+		String s = b.toString();
+		if (s.length() > 0)
+			s = s.substring(0, s.length()-1);
+		else
+			s = "null";
+		Main.pref.put("toolbar", s);
+		refreshToolbarControl();
+	}
+
+	/**
+	 * @return The parameter (for better chaining)
+	 */
+	public Action register(Action action) {
+		actions.put((String)action.getValue("toolbar"), action);
+		return action;
+	}
+
+	public void refreshToolbarControl() {
+		control.removeAll();
+		for (String s : getToolString()) {
+			if (s.equals("|"))
+				control.addSeparator();
+			else
+				control.add(actions.get(s));
+		}
+		control.setVisible(control.getComponentCount() != 0);
+	}
+}
Index: src/org/openstreetmap/josm/io/OsmConnection.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmConnection.java	(revision 171)
+++ src/org/openstreetmap/josm/io/OsmConnection.java	(revision 172)
@@ -37,11 +37,15 @@
 	protected HttpURLConnection activeConnection;
 
-	private static OsmAuth authentication;
+	private static OsmAuth authentication = new OsmAuth();
 	/**
 	 * Initialize the http defaults and the authenticator.
 	 */
 	static {
-		HttpURLConnection.setFollowRedirects(true);
-		Authenticator.setDefault(authentication = new OsmAuth());
+		//TODO: refactor this crap (maybe just insert the damn auth http-header by yourself)
+		try {
+	        HttpURLConnection.setFollowRedirects(true);
+	        Authenticator.setDefault(authentication);
+        } catch (SecurityException e) {
+        }
 	}
 
Index: src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
===================================================================
--- src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 171)
+++ src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 172)
@@ -66,4 +66,6 @@
 						if (!f.exists())
 							f = new File("bin/org/openstreetmap/josm/Main.class");
+						if (!f.exists())
+							f = new File("build/org/openstreetmap/josm/Main.class");
 						if (f.exists()) {
 							DateFormat sdf = SimpleDateFormat.getDateTimeInstance();
