1. Overview Description DRAG & DROP (later referred to as DND) enhances the operability of the program and enhances the visual operation capability of the program. Thereby improving the appeal of the program. (Surface Kung Fu is also very important) implementation of DND in SWT mainly involves three classes and two interfaces and two event classes: Class: Class:
Org.eclipse.swt.dnd.dragsource
Org.eclipse.swt.dnd.droptarget
org.eclipse.swt.dnd.Transfer Interface: org.eclipse.swt.dnd.DragSourceListener org.eclipse.swt.dnd.DropTargetListener event class: org.eclipse.swt.dnd.DropTargetEvent org.eclipse.swt.dnd.DragSourceEvent I learned: 1. "SWT / JFACE IN Action" http://chinateam.myrice.com/matrix/java/j2se/java_ide/eclipse 1 20Action.pdf 2. "Guide to SWT and JFACE" http: //www.fixdown.com/soft/21244.htm 3. Drag and drop http://www.eclipse.org/articles/article-swt-dnd/dnd-in-swt.html#_dt10d 4. Drag and DROP In The Eclipse UI http://www.eclipse.org/articles/article-workbench-dnd/drag_drop.html, compared to the DND, there are many more than two documents. If everyone's English is better, I suggest it to look directly after two documents.
2. DRAG AND DROP implementation process Drag & DROP consists of two steps: DRAG and DROP process (nonsense, but let's talk about it.). 2.1 The steps of the DRAG process to implement the DRAG process are as follows. 1. Determine the DND operation source component and claim the corresponding DragSource. Dragsource classes and DROPTARGETs to be mentioned later are all encapsulation classes, and the parameter tables of constructor are all (Control Control, Int Style). By passing a Control to the DragSource constructor, one component can be set to a DND operation source, the second parameter of the constructor represents the operational manner allowed by the DND operation source. It should be noted that you cannot specify a component as multiple DND operation sources, otherwise SwTerror [3] is generated (more serious). In other words, a component can only provide a type of data for DND operations. The STYLE parameter involved above determines how the DND operation recipient can take the operation of the transmitted data, the value of the Style can be