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 forJTable
, 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).