How to serialize/deserialize a JTree ?

F

fmarchioni

Hi all!
I'm using an application where a JTree is dynamically built at runtime.
I need to add a function to save a "snapshot" of the jtree.
I think that serialization could be a valid option.
So I serialized the root DefaultMutableTreeNode and de-serialized it.

Unfortunately it doesn't work as I expected.

The jtree I re-build is incorrect (node names are missing, moreover
application locks if I check one of the nodes)

Has anybody tried to save the state of a Jtree ?
Do I need to serialize also other components (which are linked with the
jtree) ?
any advice will be very much appreciated....
thanks
Francesco
 
D

David Linsin

Hi Francesco,

I have been using the XMLEncoder/Decoder to save state of Swing objects
on a projects. Works okay...maybe you wanna give it a try.

Greetings, David
http://blog.linsin.de
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JTree model update problem 3
Extra Row in JTree 6
JTable within JTree 1
JTree oddity... 5
Jtree renderers 0
[SWING] Problem with JTree 2
JTree? 10
JTree navigation 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top