• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to save default text in notepad

 
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
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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
 
Rancher
Posts: 3191
29
  • 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
Rancher
Posts: 3191
29
  • 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
Rancher
Posts: 3191
29
  • 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
 
Sheriff
Posts: 21974
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java SE API
N-Index
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic