Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes How to save default text in notepad Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to save default text in notepad" Watch "How to save default text in notepad" New topic
Author

How to save default text in notepad

Vivek Moyal
Ranch Hand

Joined: Nov 02, 2009
Posts: 57
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

Joined: Jul 26, 2007
Posts: 10270
    
    8

Notepad? Do you mean JTextArea?
You will have to rephrase your question to make it more legible


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
Text and New Lines might help (but I'm not sure I understand the question either).
Vivek Moyal
Ranch Hand

Joined: Nov 02, 2009
Posts: 57
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

Joined: Nov 02, 2009
Posts: 57
no i want to read it through a String variable and write this string variable to a notepad
Vivek Moyal
Ranch Hand

Joined: Nov 02, 2009
Posts: 57
And i think \n is not working with java
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
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

Joined: Nov 02, 2009
Posts: 57
i dont get you what is this newline method
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
Vivek Moyal wrote:i dont get you what is this newline method


Read the API and it will tell you.
Vivek Moyal
Ranch Hand

Joined: Nov 02, 2009
Posts: 57
i dont get you which api and which part i read
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19685
    
  20

Java SE API
N-Index


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: How to save default text in notepad