Click to See Complete Forum and Search --> : How do you read each line of a text area???
Cameron Ylimaki
Mar 8th, 2005, 04:25 PM
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:
textStorge = textArea.read(Reader());
manavo11
Mar 8th, 2005, 04:37 PM
Sorry I can't be more specific, but maybe with the IndexOf and subString methods and a loop you can do something?
Cameron Ylimaki
Mar 8th, 2005, 04:56 PM
i dont really understand
does anyone else hav any ideas???
Dillinger4
Mar 8th, 2005, 05:47 PM
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) :rolleyes:.
What about read(Reader in, Object desc)? Anybody figure out how to use it?
Dillinger4
Mar 8th, 2005, 07:03 PM
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(). :lol:
BufferedWriter buff = new BufferedWriter(new FileWriter("C:\\test.txt"));
jta.write(buff);
Cameron Ylimaki
Mar 8th, 2005, 08:31 PM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.