For a GUI component to act as the destination of a drag-and-drop, it must be associated with two objects:
The DropTarget's constructor makes associations with both the DropTarget and the DropTargetListener objects. Alternatively, the DropTarget has setComponent() and addDropTargetListener() methods. Newly defined java.awt.Component methods are used by the DropTarget's constructors to inform the Component that it is now associated with the DropTarget.
The following are the additions to java.awt.Component:
public void setDropTarget( DropTarget dt ) Public DropTarget getDropTarget()
Let's define a droppable component. After you create a DropTarget ...