4

I have a non-serializable object (it contains bound properties) listed in a JavaFX TreeView. I'd like the user to be able to drag the TreeView item containing the object onto a LineChart to be plotted but I can't populate a DragBoard with this object since it's non-serializable. I don't really want to copy the object, just a link to it. I tried setting the TransferMode to LINK but this seems to be only an indicator of the intended action; the process still required serialization of the object to be dragged.

How can I drag and drop only a reference to an object?

4

1 回答 1

1

If you want your treeitem object to be plotted in LineChart then first while dragging you can save your object instance in your static temp variable and when your drop action happens in your chart then just retrieve that same temp variable and you can manipulate your LineChart easily.

The workaround of the manual drag and drop is done in here JavaFX Drag and Drop Cell in ListView

Thanks

于 2012-09-01T11:25:24.070 回答