It's hard to imagine a windowing system that doesn't support drag and drop. This capability makes it possible to drag document icons to trashcan icons and then drop these "documents" into the "trash can." (Obviously, the document files associated with these icons are deleted.) Furthermore, drag and drop supports the copying or moving of file icons from one location to another location in a directory hierarchy. (As you know, the actual files are copied or moved behind the scenes.) Wherever it makes sense to drag an icon to another window, drop this icon onto that window, and perform an operation in the background, drag and drop is used. Because modern windowing systems support drag and drop, Java must also support this capability, or be found inadequate. Therefore, it's most fortunate for Java that drag and drop has found its way into the JFC ”as the Drag and Drop API. This API can be used to perform drag and drop between Java programs or between Java and non-Java programs. The Drag and Drop API is based on the Data Transfer API that debuted in Java Version 1.1. This API simplifies the transfer of data between Java and non-Java programs or between Java programs. Before exploring the Drag and Drop API, it's important to learn about the Data Transfer API. After that, the Drag and Drop API will be easier to understand. |