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.
by Kulvir Singh Bhogal
November 9, 2004
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, orworst of allnever 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?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!