JavaFX-Outlook附件-DnD [英] JavaFX - Outlook attachments - DnD
本文介绍了JavaFX-Outlook附件-DnD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我需要DnD解决方案以将Outlook邮件附件拖到堆栈窗格中.
Hello i need a DnD Solution to Drag Outlook Mail Attachments to a Stackpane.
JavaFX/Outlook 2010
JavaFX / Outlook 2010
stackpaneDragAndDropZone.setOnDragOver((DragEvent event) -> {
Dragboard db = event.getDragboard();
System.out.println(db.getContentTypes());
});
具有此输出:
[[message/external-body;access-type=clipboard;index=0;name="faxdoc-150217-1300-+49-206581978.pdf"], [RenPrivateItem]]
我如何使用此RenPrivateItem?
How can i use this RenPrivateItem?
在常规Java上,我得到了一个包含以下代码的文件:
On regular Java i got a file with this code:
dropTarget.addDropTargetListener(new DropTargetAdapter() {
public void drop(DropTargetDropEvent dtde) {
Transferable t = dtde.getTransferable();
try {
DataFlavor[] dataFlavors = t.getTransferDataFlavors();
dtde.acceptDrop(DnDConstants.ACTION_COPY);
//create a temp file
File temp = File.createTempFile("temp-file-name", ".tmp");
for (int i = 0; i < dataFlavors.length; i++) {
File file = new File(t.getTransferData(dataFlavors[i]).toString().replace("[", "").replace("]", ""));
Desktop.getDesktop().open(new File(file.getCanonicalPath()));
}
dtde.dropComplete(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
推荐答案
顾名思义,这是一种私有格式.但是您将获得CF_FILEDESCRIPTOR和CF_FILECONTENTS格式.
It is a private format as the name suggests. But you will get CF_FILEDESCRIPTOR and CF_FILECONTENTS formats.
这篇关于JavaFX-Outlook附件-DnD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文