I have a JTextArea that is supposed to display 2 different .java files within it. The problem I'm having is that the second file being read overwrites the first read file. I'm sure there's a simple fix, just can't seem to figure it out. Here's the code.
Here is the Applet class that initializes the above one:
> The problem I'm having is that the second file being read overwrites the first read file.
you need to use append() after your first read()
some of the ways might be:
1) use the fileReader to read/append each line,
2) create another JTextArea
3) read the files in the reverse order
i.e. the second file read first, then store the text in a String String temp = text.getText();
then text.read(..) which will be the first file over-writing the second file
Joined: Apr 27, 2012
Thanks! Solved my problem.
subject: Reading 2 Different Files into 1 JTextArea