Results 1 to 6 of 6
- 09-12-2011, 08:25 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
Carriage Return Mark for JTextArea
Assume i have JTextArea contained With long Wraped Text, This texts are contained with some Paragraph, Also I have String variable to hold this JTextArea content gathered by getText(), but when i write this String to file and reopen it weird thing happen. the text has no paragraph, all wraped as if it has no Carriage Return mark. can anyone show the way to fix this ?
Java Code:JTextArea myTextArea = new JTextArea(); String myString = myTextArea.getText();
- 09-12-2011, 09:18 PM #2
Re: Carriage Return Mark for JTextArea
Does the textarea wrap its contents without any lineend characters?
Does your textarea's contents have lineend characters in it that are not being returned by the getText() method?
Do you mean that the text in the file was all on one line? IE no lineends.all wraped as if it has no Carriage Return mark.
- 09-12-2011, 09:34 PM #3
Re: Carriage Return Mark for JTextArea
Write to file, how? Reopen, how?but when i write this String to file and reopen it weird thing happen.
Recommended reading: How To Ask Questions The Smart Way
db
- 09-13-2011, 04:56 PM #4
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
Re: Carriage Return Mark for JTextArea
yes it does have a method to make it content wrapedDoes the textarea wrap its contents without any lineend characters?
Does your textarea's contents have lineend characters in it that are not being returned by the getText() method?but when i open this created file with notepad , its only has 1 very long line. aka no paragraph no new linesJava Code:String myString = jTextArea[0].getText()+jTextArea[1].getText()+jTextArea[2].getText(); //call my function to write into the file writeMyFile(mystring)
- 09-13-2011, 04:57 PM #5
Re: Carriage Return Mark for JTextArea
what happens if you open the file in another editor? Not all editors process lineend/carriage return the same way.
In Notepad: Are there small squares where there would be lineend/carriage returns?Last edited by Norm; 09-13-2011 at 05:01 PM.
- 09-13-2011, 05:03 PM #6
Member
- Join Date
- Aug 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Disable enter/return key in JTextArea
By applewood13 in forum AWT / SwingReplies: 3Last Post: 05-29-2011, 05:59 PM -
Can't determine whether a text file ends with carriage return
By PrinceSendai in forum New To JavaReplies: 4Last Post: 05-06-2011, 07:04 PM -
Carriage Returns in JTEXTAREA
By AJArmstron@aol.com in forum Advanced JavaReplies: 8Last Post: 04-17-2010, 07:34 PM -
Waiting for a carriage return
By Ebodee in forum New To JavaReplies: 1Last Post: 02-12-2010, 03:46 AM -
New line or Carriage Return through FileWriter
By johnt in forum New To JavaReplies: 2Last Post: 05-20-2007, 09:13 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks