hi,
I have a jTable and I want to display in it a result of a command,then I used an object of the StringTokenizer class to separate between the lettres of the result and display the result in the table jTable1,but when I use system.out.prin tln(st.nextToke n()) it works correctly but in the table it display when I compile the last result
this is my code:
I don't know where is the fault,can some one help me and thanks for help
I have a jTable and I want to display in it a result of a command,then I used an object of the StringTokenizer class to separate between the lettres of the result and display the result in the table jTable1,but when I use system.out.prin tln(st.nextToke n()) it works correctly but in the table it display when I compile the last result
this is my code:
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 } 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); } }
Comment