Wednesday, 15 August 2012

java - Reloading a JTree from a saved file -



java - Reloading a JTree from a saved file -

i read jtree file. want show in jpanel. reload defaulttreemodel after reading file but, doesn't work.

public class dynamictree extends jpanel { protected mydefaultmutabletreenode rootnode; protected defaulttreemodel treemodel; protected jtree tree; private transient toolkit toolkit = toolkit.getdefaulttoolkit(); private url helpurl; public void reloadmodel(){this.treemodel.reload();} }

read file loading dynamictree

address = (dynamictree) readdynamictreefromfile(); mainpanel.settree4load(address);

the settree4load(address) method is:

public static void settree4load(dynamictree tree) { treepanel=tree; //treepanel current dynamictree in frame treepanel.reloadmodel(); }

thanks in advance :)

instead of changing tree. seek set model , datamodel loaded tree panel tree

java swing jtree reloaddata defaulttreemodel

No comments:

Post a Comment