I’m trying to make a program that allows users to drag files onto a window, it will then draw their icon/name where they dropped it. This I have working. My only issue is that I want the users to then be able to drag the File off of it (it will do something in the middle). So they can keep dragging a bunch of files on, then take them off (I also want it to look like it’s supposed to, pic below). I believe if you drag an item in a filechooser off of it, it will do what I want, I’m just not sure how they do it.
Here’s an example of me dragging a file onto the panel:

(source: gyazo.com)
I want to be able to do the same thing, but with dragging it off. Does anyone know how to go about doing this? I’m using DragAndDrop listeners to detect when the users drag a file onto it, I’m thinking I should be able to sort’ve do the opposite, put my file onto draganddrop handler somehow.
Thanks 🙂
Figured it out myself a while ago, figured I’d post the answer here for anyone who wanted it; had to make my own class which extended JLabel (I’m using a JLabel to display the icon), which implements Transferable, DragSourceListener, and DragGestureListener, and override the required methods of course. Took a while to work out all the kinks, but got it to work 🙂