I have a scenario where I have an Array of CurriculumSubject objects (which in turn has creted 15 JTextField object instances) and then a text file.
I want to iterate through the CurriculumSubject Array (and each JTextField for each subject) and go through the text file line by line, setting each JTextField to one line - and then move on to the next.
Currently, I have this method which receives a File object:
How can I integrate a BufferedReader in to this so that as I move through the 15 JTextFields, the BufferedReader reads the next line of the file?
Campbell misunderstood. i see what you want to do. set the texFields from info in the file. if someone doesn't answer first i'll see if i can find something like that.
i havent read this but it seems like what you want
read file
Thanks Randall - you are correct. The BufferedReader is to handle the text file and go through the file line by line. I already have managed to access the JTextFields through set and get, so that part of the problem is sorted - it's reading the file line by line that I really need help with. Thanks.
Adam Cripps wrote:Thanks Winston. However, I will need to iterate through the file - how do I knit the two iterations together?
I suggest you have a think about it and try something yourself. I've already given you all the information you need to write a read loop of your own using either for or while.
Winston
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here