JEditorPane pane = ((JEditorPane) source); Document d = pane.getDocument(); if (d instanceof HTMLDocument) insertHTML(pane, (HTMLDocument) d, 0, html, 0, 0, addTag);
HTMLDocument d = getHTMLDocument(source); int offset = source.getSelectionStart(); int length = d.getLength(); boolean inserted = true; if (! tryInsert(source, d, offset, parentTag, addTag)) { inserted = tryInsert(source, d, offset, alternateParentTag, alternateAddTag); } if (inserted) adjustSelection(source, d, offset, length);
      public void actionPerformed(ActionEvent ae)      {        Object source = ae.getSource();        if (source instanceof JEditorPane)          {            JEditorPane pane = ((JEditorPane) source);            Document d = pane.getDocument();            if (d instanceof HTMLDocument)              insertHTML(pane, (HTMLDocument) d, 0, html, 0, 0, addTag);            // FIXME: is this correct parameters?          }        // FIXME: else not implemented      }