public void replaceSelection (String replacement)

Replaces the selection with the given replacement String. If there is no selection, then the replacement text is simply inserted at the current caret position. If there was a selection, then the selection is cleared and the given replacement text inserted.

Parameters:
replacement    the replacement string