1 import java.awt.*; 2 import java.awt.event.*; 3 import javax.swing.*; 4 import java.awt.datatransfer.*; 5 6 7 void jButton1_actionPerformed(ActionEvent e) { 8 //this code will copy the "Hello" to the Clipboard 9 10 StringSelection strSel = new StringSelection("Hello"); 11 this.getToolkit().getDefaultToolkit().getSystemClipboard().setContents(strSel, 12 strSel); 13 14 }