0

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.

Ashish Pancholi
  • 4,569
  • 13
  • 50
  • 88
  • Check this one: http://stackoverflow.com/questions/1204580/swing-application-drag-drop-to-the-desktop-folder – Snehal Patel Jun 05 '13 at 08:39
  • @user2389335 Thanks but still the same issue. How can I get the drop location? Imagine, I have dragged a file and dropped that file into `C:\abc` folder. So I need to identify that `C:\abc` location. – Ashish Pancholi Jun 05 '13 at 10:35
  • possible duplicate of [How to identify the drop location?](http://stackoverflow.com/questions/16942409/how-to-identify-the-drop-location) – kleopatra Jun 17 '13 at 09:30

0 Answers0