Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to save default text in notepad

 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to save text in notepad and o when i write it write it in a single line but i want it in next line when there is next line in code . like

"my name
is vivek"

when i write it .notepad show me "my name is vivek"
but i want the text as same as above so help me
 
Maneesh Godbole
Saloon Keeper
Posts: 11178
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notepad? Do you mean JTextArea?
You will have to rephrase your question to make it more legible
 
Rob Camick
Ranch Hand
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Text and New Lines might help (but I'm not sure I understand the question either).
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
like i have 3 lines and i have to write it to the notepad through the code ohk

1.My name is vivek

2.I am doing MCA

3.I like to work with Java

now i want to write these lines according to what you see here

when i write them it will be like this
1.My name is vivek[]2.I am doing MCA[]3.I like to work with java

so i think now you get what i want to ask
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no i want to read it through a String variable and write this string variable to a notepad
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And i think \n is not working with java
 
Rob Camick
Ranch Hand
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek Moyal wrote:And i think \n is not working with java


No, "\n" is not working with Notepad. Its notepad that is having problems understanding the '\n" because its expecting "\r\n".

The best solution is to use the newLine(...) method of your BufferedWriter.
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont get you what is this newline method
 
Rob Camick
Ranch Hand
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek Moyal wrote:i dont get you what is this newline method


Read the API and it will tell you.
 
Vivek Moyal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont get you which api and which part i read
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java SE API
N-Index
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic