Download the JDK
Search the Tutorials
Hide the TOC
Trail: Graphical User Interfaces
Lesson: Swing Features
Swing Features
A Visual Guide to Swing Components (Java Look and Feel)
A Visual Guide to Swing Components (Windows Look and Feel)
Pluggable Look and Feel
Data Transfer
Internationalization and Localization
Accessibility
Integrating with the Desktop
System Tray Icon Support
Questions and Exercises
Home Page > Graphical User Interfaces > Swing Features
Data Transfer

> The Swing toolkit supports the ability to transfer data between components within the same Java application, between different Java applications, and between Java and native applications. Data can be transferred via a drag and drop gesture, or via the clipboard using cut, copy, and paste.

> #### Drag and Drop

> Drag-and-drop support can be easily enabled for many of Swing's components (sometimes with a single line of code). For example, it's trivial to enable drag and drop and copy and paste support for `JTable`, Swing's table component. All you need to provide is the data representing the selection and how to get your data from the clipboard — that's it!

> #### Cut, Copy, and Paste

> Most of the text-based components, such as editor pane and text field, support cut/copy and paste out of the box. Of course, menu items need to be created and "wired up" to the appropriate actions. Other components, such as list and tree, can support cut, copy, and paste with some minimal work.

> PasswordStore supports data transfer in a variety of ways:

> - The text in both the list and the table view supports cut, copy, and paste.

> - The text fields in the Details Panel, the Filter text field, and the Notes text pane support cut/copy, paste, and drag and drop.

> - The Company icon region in the Details panel accepts a dropped image (jpg, png, gif, or tif).

Previous page: Pluggable Look and Feel
Next page: Internationalization and Localization