Originally posted by Mike Phillip:
how can I read line by line the content of a Jtextarea?
It depends on what you mean by "read". The content is already
in RAM, so there's not really i/o involved. If you just want
to process each line you can do something like this:
String[] lines = yourTextArea.getText().split("\\n"); If the content is large and you're worried about essentially
doubling its RAM footprint, then you might want to look into
yourTextArea.getDocument().
getText(offset, length,
yourSegment).
That doesn't help you go line by line, but it can minimize
copying the text.