private void addHTML(String text) {
   HTMLDocument hdoc = (HTMLDocument) doc;
   try {
     hdoc.insertAfterEnd(hdoc.getCharacterElement(hdoc.getLength()), text);
   } catch (BadLocationException | IOException ex) {
     ex.printStackTrace();
   }
 }
 private void appendMsg(String msg) {
   HTMLDocument doc = (HTMLDocument) textArea.getDocument();
   HTMLEditorKit kit = (HTMLEditorKit) textArea.getEditorKit();
   try {
     kit.insertHTML(doc, doc.getLength(), msg, 0, 0, null);
   } catch (Exception e) {
     Debug.error(me + "Problem appending text to message area!\n%s", e.getMessage());
   }
 }
 public void appendToEnd(String text) {
   Element root = document.getDefaultRootElement();
   try {
     document.insertAfterEnd(root.getElement(root.getElementCount() - 1), text);
   } catch (BadLocationException e) {
     logger.error("Insert in the HTMLDocument failed.", e);
   } catch (IOException e) {
     logger.error("Insert in the HTMLDocument failed.", e);
   }
 }
  public StyledHTMLEditorPane() {
    this.setContentType("text/html");

    this.document = (HTMLDocument) this.getDocument();

    this.setDocument(document);

    Constants.loadSimpleStyle(document.getStyleSheet());
  }
 protected StyleSheet getStyleSheet() {
   HTMLDocument doc = (HTMLDocument) getDocument();
   return doc.getStyleSheet();
 }