code: private void write(String s) {
      synchronized (document) {
        int offset = document.getLength();
        try {
          document.insertString(offset, s, attributes);
        } catch (BadLocationException e) {
          throw new UnexpectedException(e);
        }
      }
    }
docs: Writes a <code>String</code> to the <code>Document</code> using the
  current attribute set.
  @param s The <code>String</code> to write to the document.