• Post Reply Bookmark Topic Watch Topic
  • New Topic

what's wrong within this code?JTable..

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a txt file and inside have several lines of data.
-----------------------------------------------
abc;123;weather;name;month;
def;456;totto;day;month;
uti;978;california;fitness;day;
....
....
....
-----------------------------------------------

here is my code


in command line, it can print all the data line by line:

abc
123
weather
name
month
def
345
totto
day
month
uti
978
california
fitness
day


But in the JTable, it cannot display all the data.
my output was : 4 rows created, in the first row it displayed the last line data of text.txt file...
others daya no displayed.

What is wrong?
i put some code in the wrong places between codes?
why got 4 rows? i tot would be 3 rows only since i have 3 line of data in file....

anyone knows?
please...
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do the numRows and numColumns variables always have the correct value?
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i shouldn't use variable i in the for loop.
shoud put int i=0 outside while loop, and the first for loop changed to if statement.

my problem has been solved.
thank you very much.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!