Retrieving Text from the System Clipboard // The following 3 lines of code must be // on the same line Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard(). getContents(null); try { if (t != null && t.isDataFlavorSupported( DataFlavor.stringFlavor)) { String s = (String)t.getTransferData( DataFlavor.stringFlavor); process(s); } } catch (UnsupportedFlavorException e) { } catch (IOException e) { }