public void copyText(){
  int end, start;
  end=selectedCharField.getSelectionEnd();
  start=selectedCharField.getSelectionStart();
  selectedCharField.selectAll();
  selectedCharField.copy();
  selectedCharField.select(start,end);
}

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