コード例 #1
0
 private void addHTML(String text) {
   HTMLDocument hdoc = (HTMLDocument) doc;
   try {
     hdoc.insertAfterEnd(hdoc.getCharacterElement(hdoc.getLength()), text);
   } catch (BadLocationException | IOException ex) {
     ex.printStackTrace();
   }
 }
コード例 #2
0
 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());
   }
 }