views:

16

answers:

1

I've created an application in Netbeans 6.9 where my ultimate aim is to create a .tcl file(or text file will do). When i run my application once I create the .tcl file and save it at a location. When I run the 2nd time and if I open that file in my application, then I am not able to get that file.I mean the data is not appending to the file,it is replacing the text.My main aim is to use just that text file that is created. But for creating that file in my application I've many options. Can anyone suggest what should I do,such that when I run my application the 2nd or later times then my options whatever I selected before(in the previous run) should be present(selected) and also the text should be appended to that file instead of replacing.

I am not writing the text directly.I have created buttons in my application.If i click on "new node" button then a dialog box appears and asks for the node name.When I click ok button, then some text is written in that file and the status is shown in a text field(in my application) that the node is created. I want that when I open an existing file then all my statuses like "new node created","new link created",etc. should be there. Also in my link button,I've got names of all the nodes created,so I want that all those node names should be present when I open an existing file.

-Thanks in advance

A: 
     FileWriter fstream = new FileWriter("out.txt",true);//note true here/ it will open file in Appendmode
     BufferedWriter out = new BufferedWriter(fstream);
     out.write("Hello Java");
     out.close();    

It has nothing to do with netbeans

Ref

org.life.java
Thank you but I am not writing the text directly.I have created buttons in my application.If i click on "new node" button then a dialog box appears and asks for the node name.When I click ok button, then some text is written in that file and the status is shown in a text field(in my application) that the node is created. I want that when I open an existing file then all my statuses like "node created","link created",etc. should be there. Also in my link button,I've got names of all the nodes created,so I want that all those node names should be present when I open an existing file.
Antrromet
So you need to write all your status in file on the specific event
org.life.java