• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree Object Serialization.  RSS feed

 
krish rajini
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please any one help me with sample code to persist the JTree object.
i need to use it in remote client to generate the Tree structure.
i know tat serialization is not supported for
javx.swing so tat i used XMLEncoder and Decoder to save the Tree object.

when in deserialization the object is not loaded.

so please guys help me with sample code tat persist the JTree object.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
krish:
when in deserialization the object is not loaded.


If you tell us what is not working and what error are you getting, it will be better.
Not many people will be motivated to write and post entire code.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
You may find your thread moved; it is hardly an "advanced" topic.
But JTree does implement Serializable, so you could serialise it. Note the API says serialisation is not suitable for long-term persistence any more, but it doesn't say not to use serialisation for short-term persistence. Check that all the other classes involved implement Serializable too.

The alternative, which I don't know anything about, is Beans.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!