public UndoableEdit insertString(int where,String str) throws BadLocationException {
  if (where >= count || where < 0) {
    throw new BadLocationException("Invalid location",count);
  }
  char[] chars=str.toCharArray();
  replace(where,0,chars,0,chars.length);
  if (marks != null) {
    updateMarksForInsert(where,str.length());
  }
  return new InsertUndo(where,str.length());
}

public UndoableEdit insertString ( int where , String str ) throws BadLocationException { if ( where >= count || where < 0 ) { throw new BadLocationException ( "Invalid location" , count ) ; } char [ ] chars = str . toCharArray ( ) ; replace ( where , 0 , chars , 0 , chars . length ) ; if ( marks != null ) { updateMarksForInsert ( where , str . length ( ) ) ; } return new InsertUndo ( where , str . length ( ) ) ; }
inserts a string into the content .
