reindex();
int offset = event.getOffset(); int end = offset + event.getLength(); int elementIndex = rootElement.getElementIndex(offset); Element firstElement = rootElement.getElement(elementIndex);    Element[] removed = new Element[1]; Element[] added; try { String str = content.getString(0, content.length()); ArrayList elts = new ArrayList();
  protected void insertUpdate(DefaultDocumentEvent event, AttributeSet attributes)  {    reindex();    super.insertUpdate(event, attributes);  }