Index: src/org/openstreetmap/josm/gui/JMultilineLabel.java
===================================================================
--- src/org/openstreetmap/josm/gui/JMultilineLabel.java	(revision 2137)
+++ src/org/openstreetmap/josm/gui/JMultilineLabel.java	(working copy)
@@ -1,120 +1,81 @@
 // License: GPL. For details, see LICENSE file.
 
-// This class was taken from
-// http://forum.java.sun.com/thread.jspa?threadID=459705&messageID=2104021
-// - Removed hardcoded margin
-// -  Added constructor
-
 package org.openstreetmap.josm.gui;
 
+import java.awt.Component;
 import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Insets;
-import java.awt.font.FontRenderContext;
-import java.awt.font.LineBreakMeasurer;
-import java.awt.font.TextAttribute;
-import java.awt.font.TextLayout;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
+import java.awt.Window;
 
-import javax.swing.JComponent;
+import javax.swing.JLabel;
 
-public class JMultilineLabel extends JComponent {
-    private String text;
-    private int maxWidth = Integer.MAX_VALUE;
-    private boolean justify;
-    private final FontRenderContext frc = new FontRenderContext(null, false, false);
+public class JMultilineLabel extends JLabel {
+    private Component parent = null;
 
-    public JMultilineLabel(String description) {
+    /**
+     * Constructs a normal label that wraps its text according to the limits of
+     * the containing <b>window</b>.
+     * @param text
+     */
+    public JMultilineLabel(String text)
+    {
         super();
-        setText(description);
-    }
-
-    private void morph() {
-        revalidate();
-        repaint();
-    }
-
-    public String getText() {
-        return text;
-    }
-
-    public void setText(String text) {
-        String old = this.text;
-        this.text = text;
-        firePropertyChange("text", old, this.text);
-        if ((old == null) ? text!=null : !old.equals(text))
-            morph();
-    }
-
-    public int getMaxWidth() {
-        return maxWidth;
-    }
-
-    public void setMaxWidth(int maxWidth) {
-        if (maxWidth <= 0)
-            throw new IllegalArgumentException();
-        int old = this.maxWidth;
-        this.maxWidth = maxWidth;
-        firePropertyChange("maxWidth", old, this.maxWidth);
-        if (old !=  this.maxWidth)
-            morph();
+        text = text.trim().replaceAll("\n", "<br>");
+        if(!text.startsWith("<html>")) {
+            text = "<html>" + text + "</html>";
+        }
+        super.setText(text);
     }
 
-    public boolean isJustified() {
-        return justify;
+    /**
+     * Set the maximum width. This is a convenience function for using the
+     * normal setMaximumSize()
+     * @param width
+     */
+    public void setMaxWidth(int width) {
+        Dimension superDim = super.getMaximumSize();
+        super.setMaximumSize(new Dimension(width, superDim.height));
     }
 
-    public void setJustified(boolean justify) {
-        boolean old = this.justify;
-        this.justify = justify;
-        firePropertyChange("justified", old, this.justify);
-        if (old != this.justify)
-            repaint();
-    }
+    /**
+     * This overridden getPrefferedSize will try to find its parent window and
+     * derive its width from that. If none can be found, it will behave exactly
+     * as a normal 1-line label.
+     */
+    @Override
+    public Dimension getPreferredSize()
+    {
+        Dimension superPreferred=super.getPreferredSize();
 
-    public Dimension getPreferredSize() {
-        return paintOrGetSize(null, getMaxWidth());
-    }
+        // Find outer Frame
+        if(this.parent == null) {
+            this.parent = this.getParent();
+            while(this.parent.getParent() != null && !(this.parent instanceof Window)) {
+                this.parent = this.parent.getParent();
+            }
+        }
 
-    public Dimension getMinimumSize() {
-        return getPreferredSize();
-    }
+        if(this.parent == null)
+            return superPreferred;
 
-    protected void paintComponent(Graphics g) {
-        super.paintComponent(g);
-        paintOrGetSize((Graphics2D)g, getWidth());
-    }
+        int width;
+        // We can only get the bounds if the window is visible, otherwise they
+        // will be 0. We cannot poll getPreferredSize because this will lead to
+        // infinite recursion as this function will be called again
+        if(parent.isVisible()) {
+            // This is different from getWidth() as it returns the actual outer
+            // size while getWidth() returns the size as required by the
+            // contained components
+            width = parent.getBounds().width;
+        } else {
+            width = parent.getMaximumSize().width;
+        }
 
-    private Dimension paintOrGetSize(Graphics2D g, int width) {
-        Insets insets = getInsets();
-        width -= insets.left + insets.right;
-        float w = insets.left + insets.right;
-        float x = insets.left, y=insets.top;
+        width -= getInsets().left + getInsets().right;
 
-        if (width > 0 && text != null && text.length() > 0) {
-            String[] lines = getText().split("\n");
-            for(String line : lines) {
-                // Insert a space so new lines get rendered
-                if(line.length() == 0) line = " ";
-                AttributedString as = new AttributedString(line);
-                as.addAttribute(TextAttribute.FONT, getFont());
-                AttributedCharacterIterator aci = as.getIterator();
-                LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
-                float max = 0;
-                while (lbm.getPosition() < aci.getEndIndex()) {
-                    TextLayout textLayout = lbm.nextLayout(width);
-                    if (g != null && isJustified() && textLayout.getVisibleAdvance() > 0.80 * width)
-                        textLayout = textLayout.getJustifiedLayout(width);
-                    if (g != null)
-                        textLayout.draw(g, x, y + textLayout.getAscent());
-                    y += textLayout.getDescent() + textLayout.getLeading() + textLayout.getAscent();
-                    max = Math.max(max, textLayout.getVisibleAdvance());
-                }
-                w = Math.max(max, w);
-            }
-        }
-        return new Dimension((int)Math.ceil(w), (int)Math.ceil(y) + insets.bottom);
+        // Make the label not larger than required
+        return new Dimension(
+                Math.min(width, superPreferred.width),
+                superPreferred.height
+        );
     }
 }
Index: src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 2138)
+++ src/org/openstreetmap/josm/gui/ExtendedDialog.java	(working copy)
@@ -134,7 +134,7 @@
      * @param message The text that should be shown to the user
      */
     public void setContent(String message) {
-        setContent(string2label(message), true);
+        setContent(string2label(message), false);
     }
 
     /**
@@ -291,15 +291,8 @@
     public void setVisible(boolean visible) {
         if (visible) {
             repaint();
-        }
-
-        // Ensure all required variables are available
-        if(!rememberSizePref.isEmpty() && defaultWindowGeometry != null) {
-            if(visible) {
-                new WindowGeometry(rememberSizePref,
-                        defaultWindowGeometry).apply(this);
-            } else {
-                new WindowGeometry(this).remember(rememberSizePref);
+            if(!rememberSizePref.isEmpty() && defaultWindowGeometry != null) {
+                new WindowGeometry(rememberSizePref, defaultWindowGeometry).apply(this);
             }
         }
         super.setVisible(visible);
@@ -310,14 +303,13 @@
      * Set the pref to <code>null</code> or to an empty string to disable again.
      * By default, it's disabled.
      * 
-     * Note: If you want to set the width of this dialog directly use the usual
-     * setSize, setPreferredSize, setMaxSize, setMinSize
-     * 
      * @param pref  The preference to save the dimension to
      * @param wg    The default window geometry that should be used if no
      *              existing preference is found (only takes effect if
      *              <code>pref</code> is not null or empty
      * 
+     * Note: If you want to set the width of this dialog directly use the usual
+     * setSize, setPreferredSize, setMaxSize, setMinSize
      */
     public void setRememberWindowGeometry(String pref, WindowGeometry wg) {
         rememberSizePref = pref == null ? "" : pref;
@@ -387,9 +379,9 @@
      */
     private static JMultilineLabel string2label(String msg) {
         JMultilineLabel lbl = new JMultilineLabel(msg);
-        // Make it not wider than 2/3 of the screen
+        // Make it not wider than 1/2 of the screen
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-        lbl.setMaxWidth(Math.round(screenSize.width*2/3));
+        lbl.setMaxWidth(Math.round(screenSize.width*1/2));
         return lbl;
     }
 }
\ No newline at end of file
