+ 1

How to read a text file and display it's content to a textFieldPane/ textarea line by line??

There's a java project I'm currently busy with, it requires the user to fill in some boxes then their input is saved on a text file I called "data.txt". My code is working fine , I used scanner to read the data on the file but then it only displays the last line on the file. please help me with an example as a solution so I can understand better. Any help will be appreciated!

1st Dec 2016, 1:29 PM
Caswell Sibiya
Caswell Sibiya - avatar
3 Réponses
+ 30
Are you using a loop for read each line of file?
6th Dec 2016, 12:41 PM
Jose
0
yes I am, I'm using a while loop hasNext() to check if there are any other lines after the first one
6th Dec 2016, 11:34 PM
Caswell Sibiya
Caswell Sibiya - avatar
0
you must post your code
7th Dec 2016, 10:47 AM
Macarena