Index: /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java	(revision 5450)
@@ -8,5 +8,4 @@
 import java.util.List;
 
-import javax.swing.DefaultComboBoxModel;
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.Icon;
@@ -58,11 +57,9 @@
 
     protected Layer askTargetLayer(List<Layer> targetLayers) {
-        JosmComboBox layerList = new JosmComboBox();
+        JosmComboBox layerList = new JosmComboBox(targetLayers.toArray());
         layerList.setRenderer(new LayerListCellRenderer());
-        layerList.setModel(new DefaultComboBoxModel(targetLayers.toArray()));
         layerList.setSelectedIndex(0);
 
-        JPanel pnl = new JPanel();
-        pnl.setLayout(new GridBagLayout());
+        JPanel pnl = new JPanel(new GridBagLayout());
         pnl.add(new JLabel(tr("Please select the target layer.")), GBC.eol());
         pnl.add(layerList, GBC.eol());
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 5450)
@@ -1776,5 +1776,5 @@
     public void removeObsolete() {
         String[] obsolete = {
-                "edit.make-parallel-way-action.snap-threshold",  // 10/2011 - replaced by snap-threshold-percent. Can be removed mid 2012
+                "gui.combobox.maximum-row-count",  // 08/2012 - briefly introduced with #7917, can be removed end 2012
         };
         for (String key : obsolete) {
Index: /trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionEditor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionEditor.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecisionEditor.java	(revision 5450)
@@ -5,5 +5,4 @@
 import java.util.EventObject;
 
-import javax.swing.DefaultComboBoxModel;
 import javax.swing.JTable;
 import javax.swing.event.CellEditorListener;
@@ -16,10 +15,6 @@
 
     public RelationMemberConflictDecisionEditor() {
+        super(RelationMemberConflictDecisionType.values());
         setOpaque(true);
-        DefaultComboBoxModel model = new DefaultComboBoxModel();
-        model.addElement(RelationMemberConflictDecisionType.KEEP);
-        model.addElement(RelationMemberConflictDecisionType.REMOVE);
-        model.addElement(RelationMemberConflictDecisionType.UNDECIDED);
-        setModel(model);
         setRenderer(new RelationMemberConflictDecisionRenderer());
         tableCellEditorSupport = new TableCellEditorSupport(this);
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java	(revision 5450)
@@ -113,5 +113,4 @@
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
-import org.openstreetmap.josm.gui.widgets.JosmComboBox;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
 import org.openstreetmap.josm.tools.GBC;
@@ -711,6 +710,4 @@
     private final JTable membershipTable = new JTable(membershipData);
 
-    public JosmComboBox taggingPresets = new JosmComboBox();
-
     /**
      * The Add/Edit/Delete buttons (needed to be able to disable them)
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 5450)
@@ -322,6 +322,8 @@
                     public void focusGained(FocusEvent e) {
                         AutoCompletionList list = tfRole.getAutoCompletionList();
-                        list.clear();
-                        getLayer().data.getAutoCompletionManager().populateWithMemberRoles(list);
+                        if (list != null) {
+                            list.clear();
+                            getLayer().data.getAutoCompletionManager().populateWithMemberRoles(list);
+                        }
                     }
                 }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	(revision 5450)
@@ -42,5 +42,4 @@
 import javax.swing.Action;
 import javax.swing.BorderFactory;
-import javax.swing.DefaultComboBoxModel;
 import javax.swing.Icon;
 import javax.swing.JComponent;
@@ -1398,11 +1397,9 @@
             }
 
-            JosmComboBox layerList = new JosmComboBox();
+            JosmComboBox layerList = new JosmComboBox(targetLayers.toArray());
             layerList.setRenderer(new LayerListCellRenderer());
-            layerList.setModel(new DefaultComboBoxModel(targetLayers.toArray()));
             layerList.setSelectedIndex(0);
 
-            JPanel pnl = new JPanel();
-            pnl.setLayout(new GridBagLayout());
+            JPanel pnl = new JPanel(new GridBagLayout());
             pnl.add(new JLabel(tr("Please select the imagery layer.")), GBC.eol());
             pnl.add(layerList, GBC.eol());
@@ -1417,6 +1414,5 @@
                 return null;
 
-            WMSLayer targetLayer = (WMSLayer) layerList.getSelectedItem();
-            return targetLayer;
+            return (WMSLayer) layerList.getSelectedItem();
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java	(revision 5450)
@@ -6,5 +6,4 @@
 import java.awt.Component;
 
-import javax.swing.DefaultComboBoxModel;
 import javax.swing.JLabel;
 import javax.swing.JList;
@@ -17,24 +16,7 @@
 
     public AuthorizationProcedureComboBox() {
-        setModel(new AuthorisationProcedureComboBoxModel());
+        super(AuthorizationProcedure.values());
         setRenderer(new AuthorisationProcedureCellRenderer());
         setSelectedItem(AuthorizationProcedure.FULLY_AUTOMATIC);
-    }
-
-    static private class AuthorisationProcedureComboBoxModel extends DefaultComboBoxModel {
-        @Override
-        public Object getElementAt(int index) {
-            switch(index) {
-            case 0: return AuthorizationProcedure.FULLY_AUTOMATIC;
-            case 1: return AuthorizationProcedure.SEMI_AUTOMATIC;
-            case 2: return AuthorizationProcedure.MANUALLY;
-            }
-            return null;
-        }
-
-        @Override
-        public int getSize() {
-            return 3;
-        }
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5450)
@@ -826,5 +826,8 @@
             AutoCompletingTextField tf = new AutoCompletingTextField();
             initAutoCompletionField(tf, key);
-            tf.getAutoCompletionList().add(getDisplayValues(), AutoCompletionItemPritority.IS_IN_STANDARD);
+            AutoCompletionList acList = tf.getAutoCompletionList();
+            if (acList != null) {
+                acList.add(getDisplayValues(), AutoCompletionItemPritority.IS_IN_STANDARD);
+            }
             combo.setEditor(tf);
 
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java	(revision 5450)
@@ -147,4 +147,5 @@
 
     public AutoCompletingComboBox() {
+        super(new AutoCompletionListItem(JosmComboBox.DEFAULT_PROTOTYPE_DISPLAY_VALUE));
         setRenderer(new AutoCompleteListCellRenderer());
         final JTextComponent editor = (JTextComponent) this.getEditor().getEditorComponent();
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java	(revision 5450)
@@ -2,33 +2,32 @@
 package org.openstreetmap.josm.gui.widgets;
 
+import java.awt.Toolkit;
 import java.util.Vector;
 
+import javax.accessibility.Accessible;
 import javax.swing.ComboBoxModel;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JComboBox;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
-import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
+import javax.swing.JList;
+import javax.swing.plaf.basic.ComboPopup;
 
 /**
  * Class overriding each {@link JComboBox} in JOSM to control consistently the number of displayed items at once.<br/>
- * This is needed because of the default Java behaviour that may display the top-down list off the screen (see #).
- * <p>
- * The property {@code gui.combobox.maximum-row-count} can be setup to control this behaviour.
+ * This is needed because of the default Java behaviour that may display the top-down list off the screen (see #7917).
  * 
  * @since 5429
  */
-public class JosmComboBox extends JComboBox implements PreferenceChangedListener {
+public class JosmComboBox extends JComboBox {
 
     /**
-     * This property allows to control the {@link #getMaximumRowCount} of all combo boxes used in JOSM.
+     * The default prototype value used to compute the maximum number of elements to be displayed at once before 
+     * displaying a scroll bar
      */
-    public static final String PROP_MAXIMUM_ROW_COUNT = "gui.combobox.maximum-row-count";
+    public static final String DEFAULT_PROTOTYPE_DISPLAY_VALUE = "Prototype display value";
     
     /**
      * Creates a <code>JosmComboBox</code> with a default data model.
      * The default data model is an empty list of objects.
-     * Use <code>addItem</code> to add items.  By default the first item
+     * Use <code>addItem</code> to add items. By default the first item
      * in the data model becomes selected.
      *
@@ -36,11 +35,29 @@
      */
     public JosmComboBox() {
+        this(DEFAULT_PROTOTYPE_DISPLAY_VALUE);
+    }
+
+    /**
+     * Creates a <code>JosmComboBox</code> with a default data model and
+     * the specified prototype display value.
+     * The default data model is an empty list of objects.
+     * Use <code>addItem</code> to add items. By default the first item
+     * in the data model becomes selected.
+     * 
+     * @param prototypeDisplayValue the <code>Object</code> used to compute 
+     *      the maximum number of elements to be displayed at once before 
+     *      displaying a scroll bar
+     *
+     * @see DefaultComboBoxModel
+     * @since 5450
+     */
+    public JosmComboBox(Object prototypeDisplayValue) {
         super();
-        init();
+        init(prototypeDisplayValue);
     }
 
     /**
      * Creates a <code>JosmComboBox</code> that takes its items from an
-     * existing <code>ComboBoxModel</code>.  Since the
+     * existing <code>ComboBoxModel</code>. Since the
      * <code>ComboBoxModel</code> is provided, a combo box created using
      * this constructor does not create a default combo box model and
@@ -53,10 +70,10 @@
     public JosmComboBox(ComboBoxModel aModel) {
         super(aModel);
-        init();
+        init(aModel != null && aModel.getSize() > 0 ? aModel.getElementAt(0) : DEFAULT_PROTOTYPE_DISPLAY_VALUE);
     }
 
     /** 
      * Creates a <code>JosmComboBox</code> that contains the elements
-     * in the specified array.  By default the first item in the array
+     * in the specified array. By default the first item in the array
      * (and therefore the data model) becomes selected.
      *
@@ -66,10 +83,10 @@
     public JosmComboBox(Object[] items) {
         super(items);
-        init();
+        init(items != null && items.length > 0 ? items[0] : DEFAULT_PROTOTYPE_DISPLAY_VALUE);
     }
 
     /**
      * Creates a <code>JosmComboBox</code> that contains the elements
-     * in the specified Vector.  By default the first item in the vector
+     * in the specified Vector. By default the first item in the vector
      * (and therefore the data model) becomes selected.
      *
@@ -79,32 +96,33 @@
     public JosmComboBox(Vector<?> items) {
         super(items);
-        init();
+        init(items != null && !items.isEmpty() ? items.get(0) : DEFAULT_PROTOTYPE_DISPLAY_VALUE);
     }
     
-    protected void init() {
-        setMaximumRowCount(Main.pref.getInteger(PROP_MAXIMUM_ROW_COUNT, 20));
-    }
-    
-    /**
-     * Registers this combo box to the change of the property {@code gui.combobox.maximum-row-count}.<br/>
-     * Do not forget to call {@link #unregisterFromPreferenceChange} when the combo box is no longer needed.
-     * @see #unregisterFromPreferenceChange
-     */
-    public final void registerToPreferenceChange() {
-        Main.pref.addPreferenceChangeListener(this);
-    }
-    
-    /**
-     * Unregisters this combo box previously registered by {@link #registerToPreferenceChange}.
-     * @see #registerToPreferenceChange
-     */
-    public final void unregisterFromPreferenceChange() {
-        Main.pref.removePreferenceChangeListener(this);
-    }
-
-    @Override
-    public void preferenceChanged(PreferenceChangeEvent e) {
-        if (PROP_MAXIMUM_ROW_COUNT.equals(e.getKey())) {
-            setMaximumRowCount(Main.pref.getInteger(PROP_MAXIMUM_ROW_COUNT, 20));
+    protected void init(Object prototype) {
+        if (prototype != null) {
+            setPrototypeDisplayValue(prototype);
+            int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
+            // Compute maximum number of visible items based on the preferred size of the combo box. 
+            // This assumes that items have the same height as the combo box, which is not granted by the look and feel
+            int maxsize = (screenHeight/getPreferredSize().height) / 2;
+            // If possible, adjust the maximum number of items with the real height of items
+            // It is not granted this works on every platform (tested OK on Windows)
+            for (int i = 0; i < getUI().getAccessibleChildrenCount(this); i++) {
+                Accessible child = getUI().getAccessibleChild(this, i);
+                if (child instanceof ComboPopup) {
+                    JList list = ((ComboPopup)child).getList();
+                    if (list != null) {
+                        if (list.getPrototypeCellValue() != prototype) {
+                            list.setPrototypeCellValue(prototype);
+                        }
+                        int height = list.getFixedCellHeight();
+                        if (height > 0) {
+                            maxsize = (screenHeight/height) / 2;
+                        }
+                    }
+                    break;
+                }
+            }
+            setMaximumRowCount(Math.max(getMaximumRowCount(), maxsize));
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitiveTypesComboBox.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitiveTypesComboBox.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitiveTypesComboBox.java	(revision 5450)
@@ -10,8 +10,5 @@
 
     public OsmPrimitiveTypesComboBox() {
-        for (OsmPrimitiveType type: OsmPrimitiveType.values()){
-            if(type.getOsmClass() != null)
-                addItem(type);
-        }
+        super(OsmPrimitiveType.dataValues());
     }
 
Index: /trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(revision 5449)
+++ /trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(revision 5450)
@@ -5,10 +5,8 @@
 
 import java.awt.event.KeyEvent;
-import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.util.HashMap;
 
 import javax.swing.UIManager;
@@ -17,5 +15,5 @@
 
 /**
- * see PlatformHook.java
+ * @see PlatformHook
  */
 public class PlatformHookOsx extends PlatformHookUnixoid implements PlatformHook, InvocationHandler {
