开发者

Java DnD - Java Component to .Net Component

开发者 https://www.devze.com 2022-12-25 23:50 出处:网络
I\'m trying to use Java drag and drop to drag an object from a JTree into a native .NET component that is embedded in my app.This .NET component only accepts File objects, so I\'m having trouble with

I'm trying to use Java drag and drop to drag an object from a JTree into a native .NET component that is embedded in my app. This .NET component only accepts File objects, so I'm having trouble with the DnD's Transferable object. Anyone know how I can make this Transferable "look" like a file to this .Net component?

p.s. I need this answer 开发者_StackOverflowas Quickly as possible. Thanks!


The way to do is to provide a DataFlavor that is compatible between Java and .net. Or, to make things more clear, your Transferable must handle a DataFlavor that your .net application sends to your java one. As an example, using the javaRemoteObjectMimeType would allow you to use a String representation of the file name that your .,net application could handle.

In fact, the only thing your Java application may provide is a list of DataFlavor. it's your .net application's job to find a DataFlavor that is suitable.

0

精彩评论

暂无评论...
验证码 换一张
取 消