Drag and Drop - Swing Compatibility
Scott Palmer
swpalmer at gmail.com
Tue Mar 26 10:28:44 PDT 2013
I'm porting my mixed Swing/JavaFX app to full JavaFX. One thing I can do in the application is drag an object from a JTree and drop it into my Scene.
Swing allows me to have an arbitrary Java Object as the data in the Transferrable. When dropped this shows up in a DragBoard with MIME type "application/x-java-serialized-object" with the object instance as the data. The drop proceeds fine.
Here's the catch. The data object is NOT serializable. When I try to create the equivalent DragBoard from the JavaFX side it throws an exception saying as much as soon as I call setContent on the DragBoard.
How did Swing manage to create the DragBoard? Can I do the same?
Scott
More information about the openjfx-dev
mailing list