User ebc1e6aaea
15-04-2007 02:06:09
Is there a way to copy a molecule to the system clipboard through the JChem API? (As if right clicking on a MViewPane and choosing Edit>Copy)
Thanks
Thanks
User ebc1e6aaea
15-04-2007 02:06:09
ChemAxon 7c2d26e5cf
16-04-2007 20:16:54
Code: |
import java.awt.datatransfer.*; ... Molecule mol = viewPane.getM(0); String s = mol.toFormat("mrv"); StringSelection selection = new StringSelection(s); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); ClipboardOwner co = this; clipboard.setContents(selection,(co); |