par.removeAttributes(par); par.addAttributes(attributes); index = par.getElementCount();
a.removeAttributes(a);  a.addAttributes(attributes); } fireChangedUpdate(ev); fireUndoableEditUpdate(new UndoableEditEvent(this, ev)); } finally { writeUnlock();
  public void setParagraphAttributes(int offset, int length,                                     AttributeSet attributes,                                     boolean replace)  {    int index = offset;    while (index < offset + length)      {        AbstractElement par = (AbstractElement) getParagraphElement(index);        AttributeContext ctx = getAttributeContext();        if (replace)          par.removeAttributes(par);        par.addAttributes(attributes);        index = par.getElementCount();      }  }