public void actionPerformed(ActionEvent event){ Clipboard clip = getToolkit().getSystemClipboard(); String cmd = event.getActionCommand(); if (cmd.equals("Kopieren")) { String s = "Es ist " + System.currentTimeMillis() + "Uhr"; StringSelection cont = new StringSelection(s); clip.setContents(cont, this); } else if (cmd.equals("Einfuegen")) { Transferable cont = clip.getContents(this); if (cont == null) { System.out.println("Zwischenablage ist leer"); } else { try { String s = (String) cont.getTransferData( DataFlavor.stringFlavor ); System.out.println(s); } catch (Exception e) { System.out.println( "Zwischenablage enthält keinen Text" ); } } }}public void lostOwnership(Clipboard clip, Transferable cont){ System.out.println("Inhalt der Zwischenablage ersetzt");}