getText() sample
getLineCount(), getLineStartOffset(), and getLineEndOffset() sample
getSelectedText() sample