Hi Friends,
I'm a newbie in Java and we are creating one application where we fetch the data from the file and created the tree structure (JTree) and we are able to change the data in JTree but the changes which we made in JTree are not reflecting in our file. Please help me out with this how to push back the data to the same file with changes we made in JTree.
Thanks
Rohit Singh
Michael Dunn
Rancher
Joined: Jun 09, 2003
Posts: 4041
posted
1
you've obviously been reading about bold, how about you read up on listeners
Please read about How To Ask Questions. And also remember to Keep It Down.
Please go through the links to understand how to pose questions.
Also, though your question is related to trees, the issue that this thread topic deals with is different. Asking a different question in someone's else thread is not considered polite and is known as thread hijacking. Please start a new topic with your question to get answers.
Rohit, please don't use bold tags or colouring in regular text. Also, if you keep the right case in class names, our forum software will often create an automatic link to the Javadoc page for that class. Compare JTREE (no link) versus JTree (link).
Also, Java is not an acronym so it shouldn't be written in all upper case letters.
You have used some logic to build the tree. Use the same logic to read the tree and write to the file. This 'save' operation can be done from a button or menuitem.
If you need to actively listen and write to the file then & there, you need to write a TreeModelListener to listen to instant changes. This tutorial can help you in that.
subject: Changes which we made in JTree are not reflecting in our file