|
-
Mar 8th, 2005, 05:25 PM
#1
Thread Starter
Lively Member
How do you read each line of a text area???
I was woundering if any one knows how to read each line from a text area.
i think it has something to do with this but i am not sure:
Code:
textStorge = textArea.read(Reader());
-
Mar 8th, 2005, 05:37 PM
#2
-
Mar 8th, 2005, 05:56 PM
#3
Thread Starter
Lively Member
Re: How do you read each line of a text area???
i dont really understand
does anyone else hav any ideas???
-
Mar 8th, 2005, 06:47 PM
#4
Dazed Member
Re: How do you read each line of a text area???
Ive been trying to figure out how to do this also but i dont think that it can be done with most of the methods from the JTextArea class. There is getText(int offs, int len) but there is noway to get the width of what is contained in the column only the number of columns that are set when the JTextArea is created. So getColumns() is no good. So is getRows(). getLineCount() would be good to use but we would still need the column count. They should have a method that represents the JTextArea() as a matrix getText(int row, int col, int offs, int len) .
What about read(Reader in, Object desc)? Anybody figure out how to use it?
-
Mar 8th, 2005, 08:03 PM
#5
Dazed Member
Re: How do you read each line of a text area???
I think we want to write not read. I think reading goes into the JTextArea. To get the contents whether line by line or the whole thing we need to write.
I figured out how to write the contents of a JTextArea to a file but i couldn't figure out a way to write line by line. Too bad we couldn't use BufferedReader's readLine(). 
Code:
BufferedWriter buff = new BufferedWriter(new FileWriter("C:\\test.txt"));
jta.write(buff);
Last edited by Dilenger4; Mar 8th, 2005 at 08:08 PM.
-
Mar 8th, 2005, 09:31 PM
#6
Thread Starter
Lively Member
Re: How do you read each line of a text area???
Yeah i know it is too bad that we could not use buuffereed readers.
I will try to use the write command insted of the read command
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|