@Override protected void fireInsertUpdate(DocumentEvent evt){
  if (tokenMarker != null) {
    DocumentEvent.ElementChange ch=evt.getChange(getDefaultRootElement());
    if (ch != null) {
      tokenMarker.insertLines(ch.getIndex() + 1,ch.getChildrenAdded().length - ch.getChildrenRemoved().length);
    }
  }
  super.fireInsertUpdate(evt);
}

@ Override protected void fireInsertUpdate ( DocumentEvent evt ) { if ( tokenMarker != null ) { DocumentEvent . ElementChange ch = evt . getChange ( getDefaultRootElement ( ) ) ; if ( ch != null ) { tokenMarker . insertLines ( ch . getIndex ( ) + 1 , ch . getChildrenAdded ( ) . length - ch . getChildrenRemoved ( ) . length ) ; } } super . fireInsertUpdate ( evt ) ; }
we overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker .
