title: JLabel with HTML does not set width properly
body: <p>I am trying to set the width of a JLabel using an HTML div tag.</p>
  
  <p>Consider the following code:</p>
  
  <pre><code>import javax.swing.*;
  
  public class Xyzzy extends JFrame{
      public static void main(String[] args) {
          javax.swing.SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                  Xyzzy frame = new Xyzzy();
                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
                  frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS));
  
                  String s = "x ";
                  for (int i=0; i&lt;200; ++i)
                      s += "x ";
  
                  JLabel jl = new JLabel("&lt;html&gt;&lt;div style=\"width: 300px;\"&gt;" + s + "&lt;/div&gt;&lt;/html&gt;");
  
                  frame.add(jl);
  
                  frame.setSize(600, 600);
                  frame.setVisible(true);
              }
          });
      }
  }
  </code></pre>
  
  <p>I would have expected the JLabel to be 300 pixels wide, but in reality it is about 390 pixels wide. If I change the width specification to 200px, the resulting label is about 260 pixels wide.</p>
  
  <p>What am I doing wrong?</p>