Is there any way to identify the drop location using DragSourceAdapter.java
. I am trying to drag a image or file from the JTable
to Desktop or any other location in native file system.
For this I have written a class which extends DragSourceAdapter
-
public class FileDragGestureListener extends DragSourceAdapter implements DragGestureListener {
@Override public void dragGestureRecognized(DragGestureEvent dge) { }
@Override
public void dragEnter(DragSourceDragEvent dsde) {
DragSourceContext dragSourceContext = dsde.getDragSourceContext();
dragSourceContext.setCursor(cursor);
}
@Override
public void dragExit(DragSourceEvent dse) {
DragSourceContext dragSourceContext = dse.getDragSourceContext();
dragSourceContext.setCursor(DragSource.DefaultCopyNoDrop);
}
public void dragDropEnd(DragSourceDropEvent dsde){
Point point = dsde.getLocation();
}
}
In dragDropEnd
method, the DragSourceDropEvent
has getLocation()
but how to get the exact path where the file or image has been dropped at native file system.