fireChangedUpdate(ev);
  public void setCharacterAttributes(int offset, int length,				     AttributeSet attributes,				     boolean replace)  {    DefaultDocumentEvent ev =      new DefaultDocumentEvent(offset, length,			       DocumentEvent.EventType.CHANGE);    // Modify the element structure so that the interval begins at an element    // start and ends at an element end.    buffer.change(offset, length, ev);    Element root = getDefaultRootElement();    // Visit all paragraph elements within the specified interval    int paragraphCount =  root.getElementCount();    for (int pindex = 0; pindex < paragraphCount; pindex++)      {	Element paragraph = root.getElement(pindex);	// Skip paragraphs that lie outside the interval.	if ((paragraph.getStartOffset() > offset + length)	    || (paragraph.getEndOffset() < offset))	  continue;	// Visit content elements within this paragraph	int contentCount = paragraph.getElementCount();	for (int cindex = 0; cindex < contentCount; cindex++)	  {	    Element content = paragraph.getElement(cindex);	    // Skip content that lies outside the interval.	    if ((content.getStartOffset() > offset + length)		|| (content.getEndOffset() < offset))	      continue;	    if (content instanceof AbstractElement)	      {		AbstractElement el = (AbstractElement) content;		if (replace)		  el.removeAttributes(el);		el.addAttributes(attributes);	      }	    else	      throw new AssertionError("content elements are expected to be"				       + "instances of "		       + "javax.swing.text.AbstractDocument.AbstractElement");	  }      }    fireChangedUpdate(ev);  }