Results 1 to 11 of 11
- 10-23-2008, 08:43 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 12
- Rep Power
- 0
Saving To A New Line Using A Text File
can anyone tell me why my text is not saving to new line, it just appends at the end of the last text.
here's part of my code:
if(event.getSource() == signupButton) {
try {
outFile1 = new PrintWriter ( new FileWriter("register.txt",true));
outFile1.print(usernameField.getText()+" ");
outFile1.print(password.getText() +"* ");
outFile1.flush();
outFile1.close();JOptionPane.showMessageDialog(null,"Data have been Saved");
usernameField.setText("");
password.setText("");
}
- 10-23-2008, 08:53 PM #2
mmm, sorry but your question is very odd...
so which text does append at the end of which other text?TEAM = Together Everyone Achieves More :)
- 10-23-2008, 09:04 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 12
- Rep Power
- 0
lets say I have a textfield, and I am saving to a text file, the text from the textfield will not save to a newline in the textfile but append at the end of the existing text.
hope thats clear
- 10-24-2008, 06:56 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
After adding a text line to the file, add a new line there as well.
Can you show your code which can see what exactly going on your code. That above part not make a clear sense.
- 10-24-2008, 08:29 AM #5
There's a difference between print(...) and println(...)
db
- 10-24-2008, 08:57 AM #6
- 10-24-2008, 09:39 AM #7
- 10-24-2008, 10:40 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Why don't you workout with Darryl.Burkes' suggestion. As he says you have done very poor thing in your code.
- 10-24-2008, 02:33 PM #9
Member
- Join Date
- Oct 2008
- Posts
- 12
- Rep Power
- 0
Thank You
Thanks for nothing, the code does exactly what my code did, what I have noticed in this forum is that everyone seems to not know much about java and its suppose to be ADVANCE and comments on why was my text and new line is separated how sad db COME ON. This is the last of me using this forum.
- 10-24-2008, 03:11 PM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
No one wants to comments on you as well lol. What db is suggest you is the way you have to take. Reason is that comment on you is he(me too) cannot is any attempt you have take on in your code.
It's upto you. If you think members in our forum doesn't have much knowledge on Java, and you feel that no one here help you in the future, just left our community. Anyone cannot ask to stay here. Good luck!
- 10-24-2008, 07:21 PM #11
Your question was not clear. From what folks guessed you were asking, it does not belong in the Advanced section.
There are quite a few folks here who are knowledgeable about Java, but we can't read your mind.
More importantly, with your lack of communication skills, and lack of social skills, I sure will not miss you.
Similar Threads
-
saving to a new line a text
By jadaleus in forum Advanced JavaReplies: 1Last Post: 10-20-2008, 06:10 PM -
Saving to a Text File
By jadaleus in forum Advanced JavaReplies: 2Last Post: 10-17-2008, 06:50 PM -
Saving data in an XML file
By Thez in forum New To JavaReplies: 1Last Post: 12-08-2007, 09:24 PM -
Reading in data from file line by line
By bluekswing in forum New To JavaReplies: 1Last Post: 10-02-2007, 12:19 AM
Bookmarks