--- title: Drag and Drop order: 12 layout: page --- [[advanced.dragndrop]] = Drag and Drop ((("Drag and Drop", id="term.advanced.dragndrop", range="startofrange"))) Dragging an object from one location to another by grabbing it with mouse, holding the mouse button pressed, and then releasing the button to "drop" it to the other location is a common way to move, copy, or associate objects. For example, most operating systems allow dragging and dropping files between folders or dragging a document on a program to open it. Framework version 8.1 adds support for https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API[HTML5 drag and drop] features. This makes it possible to set components as drag sources that user can drag and drop, or to set them as drop targets to drop things on. == Drag Source Any component can be made a drag source that has textual data that is transferred when it is dragged and dropped. To make a component a drag source, you apply the [classname]#DragSourceExtension# to it. Then you can define the text to transfer, and the allowed drag effect. [source, java] ---- Label draggableLabel = new Label("You can grab and drag me"); DragSourceExtension