Created
May 15, 2013 23:15
-
-
Save Alcar32/5588181 to your computer and use it in GitHub Desktop.
Copy a string to the clipboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.datatransfer.*; | |
public static void copyStringToClipboard(String s) { | |
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); | |
clipboard.setContents(new StringSelection(s), null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment