aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes really confused about Data Flavors used for drag and drop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "really confused about Data Flavors used for drag and drop" Watch "really confused about Data Flavors used for drag and drop" New topic
Author

really confused about Data Flavors used for drag and drop

Philip Persson
Greenhorn

Joined: Jan 30, 2011
Posts: 20

I have a Transfer Hander as follows:



What I want to do is drop files onto a JTextArea and have it read the file name. It sounds simple enough but it is not because I am crossing the JVM boundary. Because I want to use native data types in the JVM it gets more complicated. In the routine I have specified my data flavor as "javaFileListFlavor" but that will never fly because I am getting data from the OS. By the way, this will be a multiple-platform application (Windows, Linux, Unix, Macintosh).

The error I get is as follows: Unsupported Flavor, application/x-java-file-list

I have read quite a few articles on this, I see that I need to somehow construct a FlavorMap using SystemFlavorMap by calling something called getNativesForFlavors which returns a map of flavors. Now, look here what it says about this map:

The Map object returned by both methods may be mutable but is not required to be,
these mappings are held in an external persistent configuration format and are loaded
from the platform to configure the FlavorMap appropriately for a given platform.


Say.....WHAT???

Does anyone have some clear examples of code that uses this? I am really confused at this point as to how I can bring this all together.

Thank you in advance for any help you might be able to offer or guidance to lessen my confusion
Philip Persson
Greenhorn

Joined: Jan 30, 2011
Posts: 20

If there are no replies does that mean I am the first to venture into this territory? Am I a pioneer?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: really confused about Data Flavors used for drag and drop