This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes How to Get a String from a Text Area? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to Get a String from a Text Area?" Watch "How to Get a String from a Text Area?" New topic

How to Get a String from a Text Area?


Joined: Oct 04, 2000
Posts: 1
Hi all,
I have encountered a small problem in my coding. Iam able to opena file into a text area. Now I need to get each line (One at a time) into a Dialog box, which has a textarea/textfeild, and two buttons "Yes" and "No" which when clicked get the next line. Iam able to open the Dialog box but I don't know how to get each line into the Dialogbox. Also once the dialog box is opened Iam unable to close it. The only thing that closes the Dialogbox is completely closing the application.
Could anybody please solve my problem.
Bob Kerfoot
Ranch Hand

Joined: Oct 01, 2000
Posts: 47
I would probably use a "LineNumberReader" and the "readLine()" method which returns "a String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached".
Hope this helps,
Bob Kerfoot - SCJP
Manish Joshi

Joined: Oct 16, 2000
Posts: 16
Dear You say that You can open up a dialog box Couldnot close it For closing you will have to write method and implement some of the listeners evnt handling interfaces please do go through JavaDocs of the packages as java.awt.event.*;
You will have to write a corresponding implemnted method for refering the close button in that write a command to hide that dialog box simple
Secondly to read One One line First cover your FileReader Object with BufferedReader object and then invoke methods like readLine();
so easily
Consider Paul's rocket mass heater.
subject: How to Get a String from a Text Area?