use of java.awt.datatransfer.StringSelection in project beast-mcmc by beast-dev.
the class TempestFrame method doCopy.
@Override
public void doCopy() {
StringWriter writer = new StringWriter();
PrintWriter pwriter = new PrintWriter(writer);
for (String tip : tempestPanel.getSelectedTips()) {
pwriter.println(tip);
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection selection = new StringSelection(writer.toString());
clipboard.setContents(selection, selection);
}
use of java.awt.datatransfer.StringSelection in project processdash by dtuma.
the class ClipboardHelper method writeContents.
@Override
protected void writeContents() throws IOException {
String id = getParameter("id");
Integer i = Integer.parseInt(id);
String clip = CLIP_ITEMS.get(i);
if (clip != null) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(clip), null);
} else {
Toolkit.getDefaultToolkit().beep();
}
DashController.printNullDocument(out);
}
Aggregations