Code example for JTextComponent

Methods: getDocumentgetSelectionEndgetSelectionStart