This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Populating a TextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Populating a TextArea" Watch "Populating a TextArea" New topic
Author

Populating a TextArea

Ian Cockcroft
Greenhorn

Joined: Feb 17, 2002
Posts: 29
Hi everyone,
I didnt know if this is more appropriate to I/O, Swing or where, so I thought I'd post here.
I am trying to populate a TextArea component from a text file. I seem to be getting some errors.
How would u do it?
Some suggestions please.
Regards
Ian
my code so far.

This compiles and runs, but doent populate the TextArea component?
[ April 22, 2002: Message edited by: Dirk Schreckmann ]
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Worked for me. Are you sure it finds the file?
Ian Cockcroft
Greenhorn

Joined: Feb 17, 2002
Posts: 29
Hi Paul, thanks for the swift reply.
It finds the file and compiles and runs, but there is no text in the TextArea. There is deffinitly text in the file.
Thanks again
Ian
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hello Ian,
It works for me as well after I make the necessary changes to get it to compile.

Are you certain that it is finding the file you are specifying? If you are and it still doesn't work for you, what happens if you place the file in the same directory as your compiled class file(s) and if you create your FileReader accordingly:
FileReader charRead = new FileReader("TestText.txt");
Does it still not work?
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating a TextArea
 
Similar Threads
JScrollPane: Change of the size of content
Can't bind JComponent location to Jlabel text property
JTextArea As JRadioButton
jframe not accepting sql query..
problem in JTable