| Author |
Displaying information from a text file in a JTable
|
dave green
Greenhorn
Joined: Oct 15, 2007
Posts: 10
|
|
Please help, I am trying to create a reports program for a test program I created. The results are saved in a .txt file with a "/" seperator and each new test is saved to a new line in the file. I then want to be able to view the results in a JTable. I can get it to work for only the first result. How do I get it to create a new row for each line of the text document? I am using String [][] data = new String [][]{{results[0], results[1]}} when reading from the file. I am probably going about this the wrong way, I know I would need to use an int variable for results[0] etc which i could do i am just not sure how to make it create a new row so that i would need to do it. Any help appreciated
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8291
|
|
Welcome to the JavaRanch. Have you looked at the API Documentation for JTable? Perhaps there is an easier way to collect data from your file and pass it in to the JTable constuctor.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Justin Chu
Ranch Hand
Joined: Apr 19, 2002
Posts: 209
|
|
|
|
 |
dave green
Greenhorn
Joined: Oct 15, 2007
Posts: 10
|
|
|
Thanks alot for that, I was obviously trying to overcomplicate it. Have found a much easier way
|
 |
 |
|
|
subject: Displaying information from a text file in a JTable
|
|
|