0

In this code, the JList is updated by overriding the drop(DropTargetDropEvent evt) method. Currently I am overriding the importData(JComponent comp, Transferable t) method in the TransferHandler class to update the JList. Both methods are called when the mouse button is released.

My question is, when the files are dragged from the JList to the desktop, what overridable method is called when the mouse button is released? I want to use FileUtils.copyFileToDirectory() to copy the files because I need to do something (for example changing the destination file names) during the copy operation.

Community
  • 1
  • 1
Mark09
  • 263
  • 1
  • 4
  • 9
  • 1
    Wow, you've gone low-level dnd. I'd have a look at [Introduction to DnD](https://docs.oracle.com/javase/tutorial/uiswing/dnd/intro.html) as there is an updated API for doing this stuff with Swing components. You can have a look at [this example](http://stackoverflow.com/questions/13855184/drag-and-drop-custom-object-from-jlist-into-jlabel/13856193#13856193) which exports data from a `JList` – MadProgrammer Apr 20 '17 at 04:41
  • Thank you but I am afraid there is no mention on how to get the destination folder. If I get it in the exportDone(), it may help. – Mark09 Apr 20 '17 at 10:05
  • You won't get the destination information, because the location could be anywhere, you need to willing to export using a verity of different methods, InputStream/Reader or as a File reference among some - the problem is, the destination would be anything (which can support your DataFlavors) – MadProgrammer Apr 20 '17 at 10:18

0 Answers0