Dragging an object object

I have a non-serializable object (it contains related properties) listed in JavaFX TreeView. I would like the user to be able to drag the TreeView element containing the object onto the constructed LineChart, but I cannot populate the DragBoard with this object since it is not serializable. I really do not want to copy the object, just a link to it. I tried to set TransferMode to LINK, but this, apparently, is only an indicator of the intended action; the process still required serialization of the object to be dragged.

How can I only drag an object link?

+4
source share
1 answer

If you want your treeitem object to appear in LineChart, you can first save the instance of the object in your static temp variable during drag and drop, and when your action on the frame happens in your diagram, then just get the same temporary variable, and you can Manipulating your LineChart is easy.

The manual drag-and-drop workaround is here JavaFX drag-and-drop box in ListView

thanks

0
source

All Articles