title: Retrieve title-attribute of hyperlink in JEditorPane on mouse hover
body: <p>I want to add tooltips to hyperlinks in a (non-editable) <code>JEditorPane</code>. I found some hints on the web, but none of them worked for me. This is my current approach:</p>
  
  <pre><code>jEditorPaneIsFollower.addMouseMotionListener(new java.awt.event.MouseMotionListener() {
      @Override
      public void mouseMoved(java.awt.event.MouseEvent evt) {
          int pos = jEditorPaneIsFollower.viewToModel(evt.getPoint());
          if (pos &gt;= 0) {
              HTMLDocument hdoc = (HTMLDocument)jEditorPaneIsFollower.getDocument();
              javax.swing.text.Element e = hdoc.getCharacterElement(pos);
              AttributeSet a = e.getAttributes();
              String href = (String) a.getAttribute(javax.swing.text.html.HTML.Attribute.TITLE);
              if (href != null) {
                  jEditorPaneIsFollower.setToolTipText(href);
              } else {
                  jEditorPaneIsFollower.setToolTipText(null);
              }
          }
          else {
              jEditorPaneIsFollower.setToolTipText(null);
          }
      }
      @Override
      public void mouseDragged(java.awt.event.MouseEvent e) {
          //
      }
  });
  </code></pre>
  
  <p>The initialization of my editor pane:</p>
  
  <pre><code>jEditorPaneIsFollower.setEditable(false);
  jEditorPaneIsFollower.setContentType("text/html");
  jEditorPaneIsFollower.setDocument(new HTMLDocument());
  jEditorPaneIsFollower.setEditorKit(new HTMLEditorKit());
  </code></pre>
  
  <p>The content of the editor pane is following:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;td width="1%" valign="top"&gt;
            &amp;#220;bergeordnet:
          &lt;/td&gt;
          &lt;td valign="top"&gt;
            &lt;a href="#cr_288" alt="DRGs als Prozesssteuerung" title="DRGs als Prozesssteuerung"&gt;288&lt;/a&gt; 
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>From debugging, I see that <code>pos</code> always changes when I move the mouse over the editor pane, however, the character element <code>e</code> is always <code>null</code>.</p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>Do I need to set editor kit and document type to HTML when initializing the editor pane?</li>
  <li>How can I fetch the right element and access the title attribute to set it as tooltip when moving the mouse over the editor pane?</li>
  </ol>