03-24-2012, 07:16 AM
(03-24-2012, 02:49 AM)aHardyX Wrote: Haha. Its not a virus. Its a glitch in your programming.
Firstly, the saving mechanism you stated above will obviously replace the text in the file. You need to open the file in your program and then make changes to it. Whenever you stream out data into a file through java, it will replace the whole file. But if you still want that method then do the following changes in your program.
On clicking the "save" button on the Save dialog, use FileReader to read the existing lines in the text file. Store those into a string array. Then rewrite them into the file using FileWriter. Then take the text from the TextArea and write them into the using FileWriter again.
That's it. If you still have problems with it just reply here. And do note that I get a NullPointerException at function loadFile(). Check that out too.
Best of luck with the coding.
And I just realized that this topic was bumped *sigh*
Its hard for me to know, posts on the first page can be months old