JTree problem!!!!!!!!!!!

I am trying to create a Chatroom application,which has three windows.One,that displays a list of permanent chat rooms(i have used static JTree to display that).The second one displays the list of custom chat rooms which users can create and third one displays both.the problem is user can create custom chat rooms from all the 3 window and join the chat.When the user is trying to create a custom chat room from default window,he/she is trying to add a new node to the custom chat room JTree.I ahve given 3 radiobuttons to visit different windows.Now if the user wishes to see the custom window,customwindow class will be called and automatically the JTree class is reinitialised.The core point is I am not storing the state of my TreeModel anywhere.So what do you all think I should do,?would it be wise to put the custom chat rooms inDB and get it whenever the tree is initialized or is there any other way,

thanks and regards

[941 byte] By [javapria] at [2007-11-27 10:17:00]
# 1

How you store the info depends on you. You have several options including your DB, XML or simply using flat files or Properties. The choice really is up to you, but I would suggest XML, since it resembles a tree structure and should be easier to spot errors if the tree structure inst what is desired.

Several resources are available on the net for writing XML data from JTree. A simple search of this forum or on Google should yeild some results.

ICE

icewalker2ga at 2007-7-28 15:48:55 > top of Java-index,Desktop,Core GUI APIs...
# 2

Check out the java.beans.XMLEncoder.

XMLEncoder e = new XMLEncoder(new BufferedOutputStream(

new FileOutputStream("Test.xml")));

e.writeObject(new JButton("Hello, world"));

e.close();

http://java.sun.com/products/jfc/tsc/articles/persistence4

imran_ea at 2007-7-28 15:48:55 > top of Java-index,Desktop,Core GUI APIs...