Add formatText method to TextField.