Paste to System Clipboard : Clipboard « JavaFX « Java

Paste to System Clipboard


import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DataFormat;

public class Main {
  public static void main(String[] args) {
    DataFormat fmt = new DataFormat("text/foo", "text/bar");
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.put(fmt, "Hello");



Related examples in the same category

1.Put string value to System Clipboard
2.Set Data Format to PLAIN TEXT when adding data to Clipboard