This content has been marked as final. Show 7 replies
872773 wrote:Huh? Swing is an API to create GUIs for client applications. Or as you call it: desktop applications :s
I am currently using JAVA 6 and my Java Desktop application shows a list of the files from server. I would like to have a download selected files to native file system using Drag and Drop. I have gone through many links but almost every link describes the Drag and Drop with-in a Java swing applications. I have not found help to implement download using drag from Java Desktop Application & drop to Native File.
I think you have your terminology mixed up. What type of application are you really talking about? A web application perhaps, since you mention a server?
It's not a web application. It's a Java desktop application using Swing. It runs on Windows, Mac OS X, Linux , and any other major desktop platform with a Java run-time. User installs and runs application on native file system and it shows a list of the files that have been uploaded to the server. User can download files from server. Now I would like to support download feature using Drag and Drop.
A drag recipient that has specific download semantics has to be written to implement those semantics.
Whether in Java or some other language is a secondary question.
Argh, I completely missed the point of the drag & drop being -the other way around-. From the application to the filesystem...
Thanks. Please consider following steps to clarify what I have explained, how it will work and what is my requirement -
1. User runs application.
2. The list of files from server displays in JTable.
3. Now user restores down the application window.
4. User selects some files from JTable.
5. Drags out of the application onto his computer to download.
6. Downloading supposed to be started from server to the location where he drops that file on his computer.
Please let me know if you need more details.
Yes it is clear now what you want to do. Unfortunately I know of no way to be able to do that. When you drag files to a Java application, you are within your realm of control (the Java application itself). You deal with the drop logic in the target, as in the component that is receiving the drop. That makes sense as depending on where you drop files you will deal with it differently. Dropping an image on a JTable may add a entry to the JTable, dropping an image on a JPanel might trigger the image to be rendered for example.
In the case you pose, the target is completely outside of your application. In fact it can be basically any other application, including the shell of the OS.
The best that I can think of is that you reserve a special area inside your own application to which you can drag and drop the files, which will cause your application to put the files in the proper spot on the filesystem. Think of it like adding a trashcan icon to which you can drag and drop stuff to remove it, only differently.
Thanks for your suggestion. I wonder there is no way to implement such drag and drop support. There are some older discussion exist for such type of implementation but they are not updated since 2010.