public static void writeToClipboard ( String text ) { Clipboard systemClipboard = Toolkit . getDefaultToolkit ( ) . getSystemClipboard ( ) ; Transferable transferableText = new StringSelection ( text ) ; systemClipboard . setContents ( transferableText , null ) ; }
Write a text to system clipboard