I have a jTable and I want to display in it a result of a command,I used an object of the StringTokenizer class to separate the result pf the command cmd and display it in the table jTable1,my problem is when I use system.out.println(st.nextToken()) it works correctly but when I use data [0][i] to display the result in the table it displays when I compile the last result of the command in all lines of the table this is my code:
public Object[][] data;
public String title[] = {"t1","t2","t3","t4","t5"};
private void init_tab() {
data = new Object[5][5];
for(int i=0;i<5;i++){
try{
String cmd = "the command "
..... //command cmd traitment
}
I
String response = build.toString();
StringTokenizer st = new StringTokenizer(response,":");
while (st.hasMoreTokens()) {
//System.out.println(st.nextToken()) ;
data[i][0]= st.nextToken();
}
}catch(Exception e){
e.printStackTrace();}
jTable1= new JTable(data, title);
jScrollPane1.setViewportView(jTable1);
}
}
can someone help me I know the problem in data[i][0] but how can I solve this problem and thanks