17. 114. 1. 拖放 |
|
- The component you drag from is called the drag source.
- The component you drop on is called the drop target.
|
SWT uses the DragSource class to represent drag sources.
It offers a single constructor: |
DragSource(Control control, int style)
|
|
DragSource Styles |
Style | Description | DND.DROP_NONE | No drag or drop supported | DND.DROP_COPY | Copies the dragged data to the drop target | DND.DROP_MOVE | Moves the dragged data to the drop target | DND.DROP_LINK | Creates a link from the dragged data to the drop target |
|
Transfer objects convert data from its Java representation to the underlying platform's data representation, and vice versa.
You can write your own Transfer classes.
Or use FileTransfer to drag and drop files and TextTransfer to drag and drop text. |
To implement drop targets, SWT uses the DropTarget class. Its semantics mirror those of DragSource, and its lone constructor looks like this: |
DropTarget(Control control, int style)
|
|