Example usage for javax.swing.text.html HTMLDocument setInnerHTML

List of usage examples for javax.swing.text.html HTMLDocument setInnerHTML

Introduction

In this page you can find the example usage for javax.swing.text.html HTMLDocument setInnerHTML.

Prototype

public void setInnerHTML(Element elem, String htmlText) throws BadLocationException, IOException 

Source Link

Document

Replaces the children of the given element with the contents specified as an HTML string.

Usage

From source file:org.languagetool.gui.ResultAreaHelper.java

private void setHeader(String txt) {
    HTMLDocument d = (HTMLDocument) statusPane.getDocument();
    Element e = d.getElement(HEADER);
    try {//from   w  w w  .  jav  a2  s .co  m
        d.setInnerHTML(e, "<p class=\"grayed\">" + txt + "</p>");
    } catch (BadLocationException ex) {
        Tools.showError(ex);
    } catch (IOException ex) {
        Tools.showError(ex);
    }
}

From source file:org.languagetool.gui.ResultAreaHelper.java

private void setMain(String html) {
    HTMLDocument d = (HTMLDocument) statusPane.getDocument();
    Element e = d.getElement(MAIN);
    try {//from w ww  .  ja  v a2 s  . c o m
        d.setInnerHTML(e, html);
    } catch (BadLocationException ex) {
        Tools.showError(ex);
    } catch (IOException ex) {
        Tools.showError(ex);
    }
}