Skip to main content

drag from java and drop to native application

1 reply [Last post]
Joined: 2005-06-30


Is it possible to somehow override the code that handles dropping on a native application (e.g. Windows Explorer)? I have a Java client that allows a user to browse and download files on a remote server. To do this, the user chooses the files to download and clicks a "Download" button. I want to allow the user to drag the files from the remote server and drop them on the local machine. From what I can see, the built in support for dragging files to Windows requires you to provide a list of Since these files don't exist on the local machine, I have to download them first to some temporary location and then provide this list. This has to occur in the getTransferData of my Transferable. Because this is invoked on the event thread, my UI is locked while the download occurs.

If possible, I would like to replace the built-in code with custom code that could handle doing the download to the local machine while allowing the UI to remain active. The way this would work would be similar to how you can drag and drop files from an FTP server in the Filezilla client to your desktop. You drag and drop the files and you get a list of files to be transferred in the queued files tab.

I've been searching for a couple of days now and haven't been able to find a solution for how to do this. Pretty much all of the examples I can find deal with dragging from a native application to Java or dragging and dropping within a Java application. Any help would be greatly appreciated.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-04-12

Hi dude, download ALL the archives can be a very expensive action, and more if you don't know what's the maximum size of them. I higly recommend you that you use FTP for that part of your project, so in the server you can have a service of FTP running and in your client you use the commands to list the files, download, etc( there are clasess on the net that already has FTP implemented ). That way the list command won't take you the time that requires the download of all the archives and it won't freeze to much the GUI. If you can't use FTP then use another thread that makes the download while the main thread keeps running the GUI. I hope it helps,