Index: /trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java	(revision 4523)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java	(revision 4524)
@@ -7,4 +7,5 @@
 import java.awt.Component;
 import java.awt.Cursor;
+import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
@@ -27,8 +28,7 @@
 import java.util.List;
 import java.util.Set;
-
 import java.util.regex.Pattern;
+
 import javax.swing.JButton;
-import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -84,9 +84,9 @@
 
     public AddWMSLayerPanel() {
-        JPanel imageryAddPanel = new JPanel(new GridBagLayout());
-        imageryAddPanel.add(new JLabel(tr("Menu Name")), GBC.std().insets(0,0,5,0));
+        super(new GridBagLayout());
+        add(new JLabel(tr("Menu Name")), GBC.std().insets(0,0,5,0));
         menuName = new JTextField(40);
         menuName.setText(tr("Unnamed Imagery Layer"));
-        imageryAddPanel.add(menuName, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        add(menuName, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
 
         final JTabbedPane tabbedPane = new JTabbedPane();
@@ -94,5 +94,5 @@
         final JPanel wmsFetchPanel = new JPanel(new GridBagLayout());
         tabbedPane.addTab(tr("WMS"), wmsFetchPanel);
-        imageryAddPanel.add(tabbedPane, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        add(tabbedPane, GBC.eop().insets(5,0,0,0).weight(1.0, 1.0).fill(GridBagConstraints.BOTH));
 
         final JTextArea serviceUrlText = new JTextArea(3, 40);
@@ -103,5 +103,6 @@
                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-        wmsFetchPanel.add(scrollPane, GBC.eop().insets(5,0,0,0));
+        scrollPane.setMinimumSize(new Dimension(60, 60));
+        wmsFetchPanel.add(scrollPane, GBC.eol().weight(1.0, 0.0).insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
         JButton getLayersButton = new JButton(tr("Get Layers"));
         getLayersButton.addActionListener(new ActionListener() {
@@ -166,5 +167,5 @@
             }
         });
-        wmsFetchPanel.add(new JScrollPane(layerTree), GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        wmsFetchPanel.add(new JScrollPane(layerTree), GBC.eol().weight(1.0, 1.0).insets(5,0,0,0).fill(GridBagConstraints.BOTH));
 
         JPanel layerManipulationButtons = new JPanel();
@@ -202,5 +203,6 @@
                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-        tmsView.add(tmsUrlScrollPane, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        tmsUrlScrollPane.setMinimumSize(new Dimension(60, 60));
+        tmsView.add(tmsUrlScrollPane, GBC.eol().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
         tmsView.add(new JLabel(trc("layer", "Zoom")), GBC.std().insets(0,0,5,0));
         tmsZoom = new JTextField(3);
@@ -211,11 +213,15 @@
             }
         });
-        tmsView.add(tmsZoom, GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        tmsView.add(tmsZoom, GBC.eol().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        tmsView.add(new JLabel(), GBC.eop().weight(1.0, 1.0).fill(GridBagConstraints.BOTH));
         tabbedPane.addTab(tr("TMS"), tmsView);
 
-        imageryAddPanel.add(new JLabel(tr("Imagery URL")), GBC.std().insets(0,0,5,0));
+        add(new JLabel(tr("Imagery URL")), GBC.std().insets(0,0,5,0));
         resultingLayerField = new JTextArea(3, 40);
         resultingLayerField.setLineWrap(true);
-        imageryAddPanel.add(new JScrollPane(resultingLayerField, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), GBC.eop().insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
+        JScrollPane bottomScrollPane = new JScrollPane(resultingLayerField, 
+                JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        bottomScrollPane.setMinimumSize(new Dimension(60, 60));
+        add(bottomScrollPane, GBC.eol().weight(1.0, 0.0).insets(5,0,0,0).fill(GridBagConstraints.HORIZONTAL));
 
         tabbedPane.addChangeListener(new ChangeListener() {
@@ -232,6 +238,4 @@
             }
         });
-
-        add(imageryAddPanel);
     }
 
@@ -506,12 +510,4 @@
     }
 
-    public static void main(String[] args) {
-        JFrame f = new JFrame("Test");
-        f.setContentPane(new AddWMSLayerPanel());
-        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        f.pack();
-        f.setVisible(true);
-    }
-
     private static String getChildContent(Element parent, String name, String missing, String empty) {
         Element child = getChild(parent, name);
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java	(revision 4523)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java	(revision 4524)
@@ -7,4 +7,5 @@
 import java.awt.Color;
 import java.awt.Component;
+import java.awt.Dialog;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
@@ -12,6 +13,9 @@
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
+import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.HierarchyEvent;
+import java.awt.event.HierarchyListener;
 import java.awt.event.MouseEvent;
 import java.io.IOException;
@@ -46,4 +50,5 @@
 import javax.swing.JToolBar;
 import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingUtilities;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -602,9 +607,22 @@
 
             public void actionPerformed(ActionEvent evt) {
-                AddWMSLayerPanel p = new AddWMSLayerPanel();
+                final AddWMSLayerPanel p = new AddWMSLayerPanel();
+                // This code snippet allows to resize the JOptionPane (fix #6090)
+                p.addHierarchyListener(new HierarchyListener() {
+                    public void hierarchyChanged(HierarchyEvent e) {
+                        Window window = SwingUtilities.getWindowAncestor(p);
+                        if (window instanceof Dialog) {
+                            Dialog dialog = (Dialog)window;
+                            if (!dialog.isResizable()) {
+                                dialog.setResizable(true);
+                                dialog.setMinimumSize(new Dimension(250, 350));
+                            }
+                        }
+                    }
+                });
                 int answer = JOptionPane.showConfirmDialog(
                         gui, p,
                         tr("Add Imagery URL"),
-                        JOptionPane.OK_CANCEL_OPTION);
+                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
                 if (answer == JOptionPane.OK_OPTION) {
                     model.addRow(new ImageryInfo(p.getUrlName(), p.getUrl()));
