As the name implies, drag and drop has two sides: the element to be dragged, and the element to be dropped on.
To enable drag for any widget or component in GWT, we have to use the addDragHandler method. For example:
Not all elements have the addDragHandler by default. If an element is not implementing the DragHandler interface, the developper needs to add the handler to the DOM handlers:
For the drop, we need to implement two handlers: DropHandler and DragOverHandler. Suppose we want to use a FlowPanel as a drop target:
That’s it. Now we can drag the Image into the FlowPanel.
There are other GWT libraries that implements Drag and Drop out of the box such as: