java - Read files and insert data count into JTable -


how read files , insert data count jtable?

i have n number of text files. need read data each file , insert data count of each corresponding file java table such that:

file name          total records exist ----------------------------------------- x1.txt                    457 x2.txt                    876 .                         . .                         . .                         . xn.txt                    345 ----------------------------------------- total                     1678 ----------------------------------------- 

can please me out ideas achieve same?

arrange read method accept file , return map<string, integer>.

private map<string, integer> readdata(file file) {     map<string, integer> map = new hashmap<string, integer>();     // fill in map file     return map; } 

once have map, can build tablemodel around it, shown in envtabletest.

private static class filedatamodel extends abstracttablemodel {      private map<string, integer> data = readdata(file);     private string[] keys;      public filedatamodel() {         keys = data.keyset().toarray(new string[data.size()]);     }     ... } 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -