Drag and Drop out of an applet

Dear Friends,

you can drag and drop a file into an applet (with full-rights, of course).

And you can drag and drop an icon in the applet itself.

But how can you drag an element in an applet and drop it _outside_ (for example on the desktop or a folder of the user).

Is this possible?

Thank you very much!

With best regards.

MfG

Inno

[387 byte] By [Innocentusa] at [2007-11-27 1:14:19]
# 1
Try this out: [url http://java.sun.com/developer/JDCTechTips/2003/tt0318.html#1] DRAGGING TEXT AND IMAGES WITH SWING[/url]
abillconsla at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 2
Sorry, but where in your Excamples can I drag something out of the applet?With best regardsMfGInno
Innocentusa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 3

> Sorry, but where in your Excamples can I drag something out of the applet?

>

> With best regards

> MfG

> Inno

Well first of all - not to be too particular - they are not my examples. I don't know the man - John Zukowski - who is credited with the T-Tips either.

Second of all - I did not just reread the entire thing before posting it. I had read it in the distant past and considered it useful, so I posted it.

Third of all, there are additional links posted within the article that might also be of some use.

Forth of all, I should not have had to go back into the article to point all this out for you ... but I did.

Lastly, the article discusses 'drag & drop', which is what you asked about. As I said, I did not re-read it and can't recall all the details, so I don't know if it will specifically answer all your questions or not. If it does not, it's not my fault.

All things considered, it would have been appreciated if you started out with "Thanks, but ... ", instead of "Sorry ... "

~Bill

abillconsla at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 4
Well, I didn't mean it so.Thank you.With best regardsInno
Innocentusa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 5
Not a problem. I tried to help and failed. No harm done.
abillconsla at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 6

I expect that you would have to configure whatever you wanted to drag out of your applet with a suitable DataFlavor such that it could actually be dropped outside of the applet.

I have no idea what specific DataFlavor you would have to use but I would suggest that examining the DataFlavor of something that you drag from outside the applet might get you started.

DrClapa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 7
How can I let an icon wander with the dragged mouse?(As a dragged file icon for example).With best regardsMfGInno
Innocentusa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 8

Hello. I have actually spent a lot of time on this myself, and soon will be going back to it. After lots of research I could not find a way to drag an object (other than text) out of an applet (or java application that matter) unless dragging to another java program. I did find very little on this topic, but one resource I found said that dragging from java to the desktop is a platform dependent thing. I'm not sure what that means as far as finding a solution to this problem. You are right about dragging files to an applet being possible, in fact I used this open source program here to implement the dropping to java part. http://iharder.sourceforge.net/current/java/filedrop/ Perhaps since this program has file dropping, it can be used maybe as a guide to implement file dragging and dropping out of Java. I haven't had the time to try doing that myself yet, but eventually I will get to attempting it. If you do figure this out before I do plase post your solution here, as will I. =)

Message was edited by:

AsSiDuL0Us

Message was edited by:

AsSiDuL0Us

AsSiDuL0Usa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 9
You might find some of these examples useful for the code they contain. At least one, the DragFileDemo, allows DnD to the Windows Desktop. http://java.sun.com/docs/books/tutorial/uiswing/dnd/examples/index.html
ChuckBinga at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 10
Ah thanks - it is possible.Great!But where is the part in the demo which handles outside-operations?Does the filechoser handle that?Can I implement that by myself?Thank you very muchWith best regardsMfGInno
Innocentusa at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...
# 11
You'll need to examine the example's code for that answer, if it's not explained in the tutorial.
ChuckBinga at 2007-7-11 23:49:39 > top of Java-index,Java Essentials,Java Programming...