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. Advertisements

  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. Advertisements

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. Assaf
    Replies:
    1
    Views:
    620
    Justin Rogers
    Feb 7, 2004
  2. Sidney Pecul

    How to "deserialize" session contents??

    Sidney Pecul, May 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,108
    William F. Robertson, Jr.
    May 8, 2004
  3. Gordz
    Replies:
    3
    Views:
    4,241
    John Oakes
    Jun 7, 2004
  4. Replies:
    3
    Views:
    779
  5. Edmond wong
    Replies:
    2
    Views:
    6,278
    Edmond wong
    Apr 29, 2005
  6. MariuszK
    Replies:
    0
    Views:
    927
    MariuszK
    Mar 19, 2007
  7. jumpz
    Replies:
    3
    Views:
    845
    Jean-Baptiste Nizet
    Nov 12, 2007
  8. hardemr
    Replies:
    3
    Views:
    402
Loading...