Beispiel #1
0
 private void copyOverviewToClipboard() throws InsufficientDataException {
   String overview = generateOverviewText();
   Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
   clipboard.setContents(
       new StringSelection(overview),
       new ClipboardOwner() {
         @Override
         public void lostOwnership(Clipboard c, Transferable t) {}
       });
 }
Beispiel #2
0
 /**
  * Returns the clipboard text.
  *
  * @return text
  */
 private static String clip() {
   // copy selection to clipboard
   final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
   final Transferable tr = clip.getContents(null);
   if (tr != null) {
     final ArrayList<Object> contents = BaseXLayout.contents(tr);
     if (!contents.isEmpty()) return contents.get(0).toString();
   } else {
     Util.debug("Clipboard has no contents.");
   }
   return null;
 }