Example #1
0
 /**
  * Copies the contents of this TextField to the {@link Clipboard} implementation set on this
  * TextField.
  */
 public void copy() {
   if (hasSelection) {
     int minIndex = Math.min(cursor, selectionStart);
     int maxIndex = Math.max(cursor, selectionStart);
     clipboard.setContents(text.substring(minIndex, maxIndex));
   }
 }
Example #2
0
 /**
  * Copies the contents of this TextField to the {@link Clipboard} implementation set on this
  * TextField.
  */
 public void copy() {
   if (hasSelection && !passwordMode) {
     clipboard.setContents(
         text.substring(Math.min(cursor, selectionStart), Math.max(cursor, selectionStart)));
   }
 }