Index: /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 13156)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 13157)
@@ -25,7 +25,10 @@
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
+import javax.swing.JEditorPane;
 import javax.swing.JWindow;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicHTML;
+import javax.swing.text.View;
 
 import org.openstreetmap.josm.Main;
@@ -227,8 +230,24 @@
 
     private void fixPanelSize(MapView mv, String text) {
-        Dimension d = displayedPanel.getPreferredSize();
-        if (d.width > mv.getWidth() / 2) {
+        int maxWidth = mv.getWidth() * 2/3;
+        JEditorPane pane = displayedPanel.getEditorPane();
+        if (pane.getPreferredSize().width > maxWidth && Config.getPref().getBoolean("note.text.break-on-sentence-mark", false)) {
             // To make sure long notes are displayed correctly
             displayedPanel.setText(insertLineBreaks(text));
+        }
+        // If still too large, enforce maximum size
+        Dimension d = pane.getPreferredSize();
+        if (d.width > maxWidth) {
+            View v = (View) pane.getClientProperty(BasicHTML.propertyKey);
+            if (v == null) {
+                BasicHTML.updateRenderer(pane, text);
+                v = (View) pane.getClientProperty(BasicHTML.propertyKey);
+            }
+            if (v != null) {
+                v.setSize(maxWidth, 0);
+                int w = (int) Math.ceil(v.getPreferredSpan(View.X_AXIS)) + 30;
+                int h = (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)) + 10;
+                pane.setPreferredSize(new Dimension(w, h));
+            }
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java	(revision 13156)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java	(revision 13157)
@@ -46,4 +46,19 @@
      */
     public JMultilineLabel(String text, boolean allBold) {
+        this(text, allBold, false);
+    }
+
+    /**
+     * Constructs a normal label but adds HTML tags if not already done so.
+     * Supports both newline characters (<code>\n</code>) as well as the HTML
+     * <code>&lt;br&gt;</code> to insert new lines.
+     *
+     * Use setMaxWidth to limit the width of the label.
+     * @param text The text to display
+     * @param allBold If {@code true}, makes all text to be displayed in bold
+     * @param focusable indicates whether this label is focusable
+     * @since 13157
+     */
+    public JMultilineLabel(String text, boolean allBold, boolean focusable) {
         JosmEditorPane.makeJLabelLike(this, allBold);
         String html = text.trim().replaceAll("\n", "<br>");
@@ -51,5 +66,5 @@
             html = "<html>" + html + "</html>";
         }
-        setFocusable(false);
+        setFocusable(focusable);
         super.setText(html);
     }
