Index: trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java	(revision 4839)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java	(revision 4840)
@@ -17,7 +17,9 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.ExpertToggleAction;
+import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener;
 import org.openstreetmap.josm.tools.GBC;
 
-public class DrawingPreference implements PreferenceSetting {
+public class DrawingPreference implements PreferenceSetting, ExpertModeChangeListener {
 
     public static class Factory implements PreferenceSettingFactory {
@@ -37,9 +39,10 @@
 
     // Options that affect performance
+    private JLabel performanceLabel = new JLabel(tr("Options that affect drawing performance"));
     private JCheckBox useHighlighting = new JCheckBox(tr("Highlight target ways and nodes"));
     private JCheckBox drawHelperLine = new JCheckBox(tr("Draw rubber-band helper line"));
     private JCheckBox useAntialiasing = new JCheckBox(tr("Smooth map graphics (antialiasing)"));
     private JCheckBox outlineOnly = new JCheckBox(tr("Draw only outlines of areas"));
-    
+
     public void addGui(PreferenceTabbedPane gui) {
         gui.display.setPreferredSize(new Dimension(400,600));
@@ -116,15 +119,23 @@
         outlineOnly.setToolTipText(tr("This option suppresses the filling of areas, overriding anything specified in the selected style."));
 
-        if (Main.pref.getBoolean("expert", false)) {
-            panel.add(new JLabel(tr("Options that affect drawing performance")),GBC.eop().insets(5,10,0,0));
-            panel.add(useAntialiasing, GBC.eop().insets(20,5,0,0));
-            panel.add(useHighlighting, GBC.eop().insets(20,0,0,0));
-            panel.add(outlineOnly, GBC.eol().insets(20,0,0,5));
-        }
-        
+        panel.add(performanceLabel, GBC.eop().insets(5,10,0,0));
+        panel.add(useAntialiasing, GBC.eop().insets(20,5,0,0));
+        panel.add(useHighlighting, GBC.eop().insets(20,0,0,0));
+        panel.add(outlineOnly, GBC.eol().insets(20,0,0,5));
+
         panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH));
         scrollpane = new JScrollPane(panel);
         scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
         gui.displaycontent.addTab(tr("OSM Data"), scrollpane);
+
+        ExpertToggleAction.addExpertModeChangeListener(this, true);
+    }
+
+    @Override
+    public void expertChanged(boolean isExpert) {
+        performanceLabel.setVisible(isExpert);
+        useAntialiasing.setVisible(isExpert);
+        useHighlighting.setVisible(isExpert);
+        outlineOnly.setVisible(isExpert);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java	(revision 4839)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java	(revision 4840)
@@ -21,7 +21,9 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.ExpertToggleAction;
+import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener;
 import org.openstreetmap.josm.tools.GBC;
 
-public class LafPreference implements PreferenceSetting {
+public class LafPreference implements PreferenceSetting, ExpertModeChangeListener {
 
     public static class Factory implements PreferenceSettingFactory {
@@ -40,5 +42,4 @@
     private JCheckBox showLocalizedName = new JCheckBox(tr("Show localized name in selection lists"));
     private JCheckBox modeless = new JCheckBox(tr("Modeless working (Potlatch style)"));
-    private JCheckBox expert = new JCheckBox(tr("Expert mode"));
     private JCheckBox dynamicButtons = new JCheckBox(tr("Dynamic buttons in side menus"));
 
@@ -95,16 +96,10 @@
 
         panel.add(showID, GBC.eop().insets(20, 0, 0, 0));
-        if (Main.pref.getBoolean("expert", false)) {
-            panel.add(showLocalizedName, GBC.eop().insets(20, 0, 0, 0));
-            panel.add(modeless, GBC.eop().insets(20, 0, 0, 0));
-        }
+        panel.add(showLocalizedName, GBC.eop().insets(20, 0, 0, 0));
+        panel.add(modeless, GBC.eop().insets(20, 0, 0, 0));
 
         dynamicButtons.setToolTipText(tr("Display buttons in right side menus only when mouse is inside the element"));
         dynamicButtons.setSelected(Main.pref.getBoolean("dialog.dynamic.buttons", true));
         panel.add(dynamicButtons, GBC.eop().insets(20, 0, 0, 0));
-
-        expert.setToolTipText(tr("The expert mode shows a lot of additional settings hidden from normal user"));
-        expert.setSelected(Main.pref.getBoolean("expert", false));
-        panel.add(expert, GBC.eop().insets(20, 0, 0, 0));
 
         panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0));
@@ -117,4 +112,12 @@
         scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 ));
         gui.displaycontent.addTab(tr("Look and Feel"), scrollpane);
+
+        ExpertToggleAction.addExpertModeChangeListener(this, true);
+    }
+
+    @Override
+    public void expertChanged(boolean isExpert) {
+        showLocalizedName.setVisible(isExpert);
+        modeless.setVisible(isExpert);
     }
 
@@ -125,9 +128,6 @@
         Main.pref.put("osm-primitives.localize-name", showLocalizedName.isSelected());
         Main.pref.put("modeless", modeless.isSelected());
-        if(Main.pref.put("expert", expert.isSelected()))
-            mod = true;
         Main.pref.put("dialog.dynamic.buttons", dynamicButtons.isSelected());
-        if(Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName()))
-            mod = true;
+        mod |= Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName());
         return mod;
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 4839)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 4840)
@@ -9,7 +9,9 @@
 import java.awt.Dimension;
 import java.awt.FlowLayout;
+import java.awt.GridBagLayout;
 import java.awt.Insets;
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
@@ -18,4 +20,5 @@
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
+import javax.swing.JCheckBox;
 import javax.swing.JComponent;
 import javax.swing.JDialog;
@@ -24,8 +27,10 @@
 import javax.swing.KeyStroke;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
 import org.openstreetmap.josm.gui.help.HelpUtil;
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane.ValidationListener;
+import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.WindowGeometry;
@@ -37,9 +42,21 @@
 
     protected JPanel buildActionPanel() {
-        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
-        pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-        pnl.add(new SideButton(new OKAction()));
-        pnl.add(new SideButton(new CancelAction()));
-        pnl.add(new SideButton(new ContextSensitiveHelpAction(HelpUtil.ht("/Action/Preferences"))));
+        JPanel pnl = new JPanel(new GridBagLayout());
+
+        JCheckBox expert = new JCheckBox(tr("Expert mode"));
+        expert.setSelected(Main.main.menu.expert.isSelected());
+        expert.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                Main.main.menu.expert.actionPerformed(null);
+            }
+        });
+
+        JPanel btns = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        btns.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+        btns.add(new SideButton(new OKAction()));
+        btns.add(new SideButton(new CancelAction()));
+        btns.add(new SideButton(new ContextSensitiveHelpAction(HelpUtil.ht("/Action/Preferences"))));
+        pnl.add(expert, GBC.std().insets(5,0,0,0));
+        pnl.add(btns, GBC.std().fill(GBC.HORIZONTAL));
         return pnl;
     }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java	(revision 4839)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java	(revision 4840)
@@ -28,4 +28,6 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.ExpertToggleAction;
+import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener;
 import org.openstreetmap.josm.gui.preferences.advanced.AdvancedPreference;
 import org.openstreetmap.josm.plugins.PluginDownloadTask;
@@ -42,5 +44,5 @@
  * @author imi
  */
-public class PreferenceTabbedPane extends JTabbedPane implements MouseWheelListener {
+public class PreferenceTabbedPane extends JTabbedPane implements MouseWheelListener, ExpertModeChangeListener {
     /**
      * Allows PreferenceSettings to do validation of entered values when ok was pressed.
@@ -56,6 +58,13 @@
     }
 
+    private class TabData {
+        public String icon;
+        public JComponent tab;
+        public String toolTip;
+        public boolean isExpert;
+    }
+
     // all created tabs
-    private final Map<String,Component> tabs = new HashMap<String,Component>();
+    private final List<TabData> tabs = new ArrayList<TabData>();
     private final static Collection<PreferenceSettingFactory> settingsFactory = new LinkedList<PreferenceSettingFactory>();
     private final List<PreferenceSetting> settings = new ArrayList<PreferenceSetting>();
@@ -94,4 +103,8 @@
     public JPanel createPreferenceTab(String icon, String title, String desc) {
         return createPreferenceTab(icon, title, desc, false);
+    }
+
+    public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane) {
+        return createPreferenceTab(icon, title, desc, inScrollPane, false);
     }
 
@@ -107,5 +120,5 @@
      * @return The created panel ready to add other controls.
      */
-    public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane) {
+    public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane, boolean isExpert) {
         JPanel p = new JPanel(new GridBagLayout());
         p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
@@ -121,13 +134,23 @@
             tab = sp;
         }
-        tabs.put(icon,tab);
-        addTab(null, ImageProvider.get("preferences", icon), tab);
-        setToolTipTextAt(getTabCount()-1, "<html>"+desc+"</html>");
+        TabData data = new TabData();
+        data.icon = icon;
+        data.tab = tab;
+        data.isExpert = isExpert;
+        data.toolTip = "<html>"+desc+"</html>";
+        tabs.add(data);
         return p;
     }
-    
+
     public void selectTabByName(String name) {
-        Component c = tabs.get(name);
-        if (c!=null) setSelectedComponent(c);
+        for (TabData data : tabs) {
+            if (data.icon.equals(name)) {
+                Component c = data.tab;
+                if (c != null) {
+                    setSelectedComponent(c);
+                }
+                return;
+            }
+        }
     }
 
@@ -227,4 +250,5 @@
         super(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT);
         super.addMouseWheelListener(this);
+        ExpertToggleAction.addExpertModeChangeListener(this);
     }
 
@@ -250,4 +274,26 @@
             }
         }
+        addGUITabs(false);
+    }
+
+    private void addGUITabs(boolean clear) {
+        boolean expert = Main.main.menu.expert.isSelected();
+        Component sel = getSelectedComponent();
+        if (clear) {
+            removeAll();
+        }
+        for (TabData data : tabs) {
+            if (expert || !data.isExpert) {
+                addTab(null, ImageProvider.get("preferences", data.icon), data.tab, data.toolTip);
+            }
+        }
+        try {
+            setSelectedComponent(sel);
+        } catch (IllegalArgumentException e) {}
+    }
+
+    @Override
+    public void expertChanged(boolean isExpert) {
+        addGUITabs(true);
     }
 
@@ -288,8 +334,6 @@
         PluginHandler.getPreferenceSetting(settingsFactory);
 
-        if(Main.pref.getBoolean("expert", false)) {
-            // always the last: advanced tab
-            settingsFactory.add(new AdvancedPreference.Factory());
-        }
+        // always the last: advanced tab
+        settingsFactory.add(new AdvancedPreference.Factory());
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 4839)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 4840)
@@ -115,5 +115,5 @@
     public void addGui(final PreferenceTabbedPane gui) {
         JPanel p = gui.createPreferenceTab("advanced", tr("Advanced Preferences"),
-                tr("Setting Preference entries directly. Use with caution!"), false);
+                tr("Setting Preference entries directly. Use with caution!"), false, true);
 
         txtFilter = new JTextField();
