question: public void copyText ( ) { int end , start ; end = selectedCharField . getSelectionEnd ( ) ; start = selectedCharField . getSelectionStart ( ) ; selectedCharField . selectAll ( ) ; selectedCharField . copy ( ) ; selectedCharField . select ( start , end ) ; }
target:  Copy text. Copy all sample text to the system clipboard.  Remember the current caret position (selection) and restore that afterwards.