I have a Paper class that has 4 attributes.
public class Paper(int id, String author, String title, int rank){
}
Then I have a LinkedList that contains the paper object.
I have a GUI that displays the paper object in the JTextArea. GUI has buttons that let users to add paper, delete and save the file. When users press save button the Paper objects are saved in a txt file as follows:
46,Evolutionary Comp,Michael Smith,12/01/10,4
61,Fuzzy Logic and App,John Peterson,13/01/10,3
118,Neural Networks,Arthur London,20/01/10,5
200,Evolutionary Comp,Scott Jones,30/01/10,1
210,Fuzzy Logic and App,Joe Wang,01/02/10,4
How do I display the content of txt file in the the JTextArea. Paper class has toString() method that prints the data of Paper Object.
Thanks. If the question is not very clear please make a comment and I will try and make it as clear as possible.
JTextarea.append(string) worked perfectly for me. Thanks
// addPaper() returns paper object
displayTxtArea.append(addPaper().toString());