advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Use Java to Interact with Your Clipboard

These days end users expect to use the ubiquitous "clipboard" concept as a transfer station for data, and if your applications don't support it, users won't be pleased. Learn how to use the java.awt.datatransfer package to cut, copy, and paste to a clipboard in Java. 


advertisement
clipboard acts as a temporary staging area where application users store cut or copied information, including text, graphics, objects, and other data types. It is a heavily exploited data sharing facility. Therefore, when developing new applications, it makes sense to expend extra effort to support the clipboard. Neglecting clipboard functionality can result in an application that gets complaints, requires new development, or—worst of all—never gets used.

But how does one go about writing to and reading from the clipboard using Java? Sun Microsystems provides the java.awt.datatransfer package as part of the Java framework, which allows you to support the clipboard. In this article, you'll learn how to copy/cut and paste both text and images using java.awt.datatransfer.


It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement