Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating a TextArea

 
Ian Cockcroft
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked for me. Are you sure it finds the file?
 
Ian Cockcroft
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic