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

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

Introduction

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

Prototype

public Element getElement(String id) 

Source Link

Document

Returns the element that has the given id Attribute.

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 {//  w  w w  .  j a v a 2 s . com
        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  w  w  . j a  v a 2s. c o  m
        d.setInnerHTML(e, html);
    } catch (BadLocationException ex) {
        Tools.showError(ex);
    } catch (IOException ex) {
        Tools.showError(ex);
    }
}

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

private void appendMain(String html) {
    HTMLDocument d = (HTMLDocument) statusPane.getDocument();
    Element e = d.getElement(MAIN);
    try {/*from w w w  . j  a v a  2  s  .  com*/
        d.insertBeforeEnd(e, html);
    } catch (BadLocationException ex) {
        Tools.showError(ex);
    } catch (IOException ex) {
        Tools.showError(ex);
    }
}