|
Code Samples Index
These code examples and other materials are subject to Sun Microsystems, Inc.
Legal Terms
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) {
}
|
Examplets provided by permission of the publisher, Addision-Wesley, and
Author Patrick Chan.
Order this book from Amazon
|