How to serialize/deserialize a JTree ?

Discussion in 'Java' started by fmarchioni@libero.it, Apr 22, 2006.

  1. Guest

    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
    , Apr 22, 2006
    #1
    1. Advertising

  2. David Linsin Guest

    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
    David Linsin, Apr 22, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gordz
    Replies:
    3
    Views:
    3,931
    John Oakes
    Jun 7, 2004
  2. Edmond wong
    Replies:
    2
    Views:
    5,974
    Edmond wong
    Apr 29, 2005
  3. MariuszK
    Replies:
    0
    Views:
    786
    MariuszK
    Mar 19, 2007
  4. jumpz
    Replies:
    3
    Views:
    619
    Jean-Baptiste Nizet
    Nov 12, 2007
  5. hardemr
    Replies:
    3
    Views:
    311
Loading...

Share This Page