I'm using a DropTarget
and implementing DropTargetListener
to handle the drop events and it works nicely for accepting Files (just see if the Transferable has a DataFlavor which returns true from isFlavorJavaFileListType()
).
Now I would like to disallow certain drop types, and give feedback appropriately:
- disallow multiple Files (only a single File accepted)
- disallow a file whose file type is not within an accepted list
Can I do this? I seem to remember working with XPCOM or COM that it was a pain, that in order to get enough information about the drop item, you had to accept it first, so there was this chicken/egg situation where you could only look at the data flavor, and not at the item itself, before accepting a drop.
If I can't reject a dropped set of items ahead of time, is there an appropriate user interface action (make a beep or something) if the dropped data is not valid?