Index: trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java	(revision 10621)
+++ trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java	(revision 10622)
@@ -6,5 +6,4 @@
 import static org.openstreetmap.josm.tools.I18n.trn;
 
-import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.Dimension;
@@ -60,4 +59,5 @@
 import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.WindowGeometry;
+import org.openstreetmap.josm.tools.MultiLineFlowLayout;
 
 /**
@@ -166,4 +166,6 @@
 
         pnl.add(tpConfigPanels, GBC.eol().fill(GBC.HORIZONTAL));
+
+        pnl.add(buildActionPanel(), GBC.eol().fill(GBC.HORIZONTAL));
         return pnl;
     }
@@ -175,5 +177,5 @@
      */
     protected JPanel buildActionPanel() {
-        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        JPanel pnl = new JPanel(new MultiLineFlowLayout(FlowLayout.CENTER));
         pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
 
@@ -202,7 +204,5 @@
     protected void build() {
         setTitle(tr("Upload to ''{0}''", OsmApi.getOsmApi().getBaseUrl()));
-        getContentPane().setLayout(new BorderLayout());
-        getContentPane().add(buildContentPanel(), BorderLayout.CENTER);
-        getContentPane().add(buildActionPanel(), BorderLayout.SOUTH);
+        setContentPane(buildContentPanel());
 
         addWindowListener(new WindowEventHandler());
Index: trunk/src/org/openstreetmap/josm/tools/MultiLineFlowLayout.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/MultiLineFlowLayout.java	(revision 10622)
+++ trunk/src/org/openstreetmap/josm/tools/MultiLineFlowLayout.java	(revision 10622)
@@ -0,0 +1,109 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.tools;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Insets;
+import java.util.function.Function;
+
+/**
+ * This is an extension of the flow layout that preferes wrapping the text instead of increasing the component width
+ * when there is not enough space.
+ * <p>
+ * This allows for a better preffered size computation.
+ * It should be used in all places where a flow layout fills the full width of the parent container.
+ * <p>
+ * This does not support baseline alignment.
+ * @author Michael Zangl
+ * @since 10622
+ */
+public class MultiLineFlowLayout extends FlowLayout {
+    /**
+     * Same as {@link FlowLayout#FlowLayout()}
+     */
+    public MultiLineFlowLayout() {
+        super();
+    }
+
+    /**
+     * Same as {@link FlowLayout#FlowLayout(int, int, int)}
+     * @param align Alignment
+     * @param hgap horizontal gap
+     * @param vgap vertical gap
+     */
+    public MultiLineFlowLayout(int align, int hgap, int vgap) {
+        super(align, hgap, vgap);
+    }
+
+    /**
+     * Same as {@link FlowLayout#FlowLayout(int)}
+     * @param align Alignment
+     */
+    public MultiLineFlowLayout(int align) {
+        super(align);
+    }
+
+    @Override
+    public Dimension preferredLayoutSize(Container target) {
+        return getLayoutSize(target, c -> c.getPreferredSize());
+    }
+
+    @Override
+    public Dimension minimumLayoutSize(Container target) {
+        return getLayoutSize(target, c -> c.getMinimumSize());
+    }
+
+    private Dimension getLayoutSize(Container target, Function<Component, Dimension> baseSize) {
+        synchronized (target.getTreeLock()) {
+            int outerWidth = getWidthOf(target);
+
+            Insets insets = target.getInsets();
+            int containerWidth = outerWidth - insets.left - insets.right - getHgap() * 2;
+
+            int x = 0;
+            int totalHeight = insets.top + insets.bottom + getVgap() * 2;
+            int rowHeight = 0;
+            for (int i = 0; i < target.getComponentCount(); i++) {
+                Component child = target.getComponent(i);
+                if (!child.isVisible()) {
+                    continue;
+                }
+                Dimension size = baseSize.apply(child);
+                if (x != 0) {
+                    x += getHgap();
+                }
+                x += size.getWidth();
+                if (x > containerWidth) {
+                    totalHeight += rowHeight + getVgap();
+                    rowHeight = 0;
+                    x = 0;
+                }
+
+                rowHeight = Math.max(rowHeight, size.height);
+            }
+            totalHeight += rowHeight;
+
+            return new Dimension(outerWidth, totalHeight);
+        }
+    }
+
+    private static int getWidthOf(Container target) {
+        Container current = target;
+        while (current.getWidth() == 0 && current.getParent() != null) {
+            current = current.getParent();
+        }
+        int width = current.getWidth();
+        if (width == 0) {
+            return Integer.MAX_VALUE;
+        } else {
+            return width;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "MultiLineFlowLayout [align=" + getAlignment() + ']';
+    }
+}
