I lose userObject in Jtree Drag Drop
Hi All,
I have created a JTree with Drag Drop capability. I have used the java.awt.DnD package for implementing the Drag & Drop. Now each of this tree node is of type DefaultMutableTreeNode, which can contain a user defined object. Now my problem is, when I select some nodes and drop it on another node I get the dragged Nodes using the tr.getTransferData() method but the objects in that Nodes are lost. Can anybody pls.... help me out its very very urgent. Thanks in advance.
Regards
Clefies R Dsouza
# 1
See my example here:
http://forum.java.sun.com/thread.jspa?threadID=5127305&messageID=9459907
If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE[/url]) that demonstrates the problem.
And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting[/url] when posting code.
# 2
Hi Rodney,
Thanks for your reply.
Actually the userObject, which is encapsulated in the DefaultMutableTreeNode node must implement the Serializable interface or the Class that implements the Transferable interface must implement the Serializable interface, since the transferable object that we obtain from DropTargetDropEvent dtde has to maintain the state of the transferable data.
My problem is solved.
Thanks & Regards
Clefies R D'Souza