Most copy to clipboard uses StringSelection and ClipBoard from DefaultToolkit
StringSelection ss = new StringSelection(textarea.getText()); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss,this);
and
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this); try { if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) { String text = (String)t.getTransferData(DataFlavor.stringFlavor); return text; } } catch (UnsupportedFlavorException e) { } catch (IOException e) { } return null;
As Andrey noted, you can find out which of them you saw. If you are looking to cut / copy / paste from / to the application and other applications, you need to use the system clipboard. If copy / paste is specially located inside your application, you can implement your own ways to create and maintain a clipboard, but the system clipboard method will be the easiest, since you do not need to reinvent the wheel.
source share