April 6, 2011, 6:25 p.m.
posted by vanadium
Several years ago, the Swing team introduced a pair of APIs for data transfer: java.awt.datatransfer and java.awt.dnd (Drag and Drop). The former abstracts the concept of data exchange to and from your application (participating with either Java or native applications) and provides clipboard-based copy-and-paste functionality. The latter particularizes these abstractions to the specifics of drag-and-drop behavior. While many developers use these APIs for working with unstyled clipboard text only, you can do much more. Both Drag and Drop events and the clipboard support images, URLs, Files, and even custom Java objects.