public void insertString(DocumentFilter.FilterBypass fb,int offset,String text,AttributeSet attrs) throws BadLocationException {
  text=replaceMetaCharacters(text);
  fb.insertString(offset,text,attrs);
  parseDocument(offset,text.length());
}

public void insertString ( DocumentFilter . FilterBypass fb , int offset , String text , AttributeSet attrs ) throws BadLocationException { text = replaceMetaCharacters ( text ) ; fb . insertString ( offset , text , attrs ) ; parseDocument ( offset , text . length ( ) ) ; }
insert a string into the document , and then parse it if the parser has been set .
