One thing I noticed is that there isn't anything defined as "jp" in the snippet of code you provided. Although I would expect you'd either have seen the error in the editor or at the very least when you compiled it. So I assume it is defined elsewhere and the problem is something else, but thought I'd mention it just in case.
BillyRay On Mar 2, 12:32 am, sriramulu chittajallu <[email protected]> wrote: > Hi friends, > > I need to work with JTable to display the table on the frame > dynamically. But When i am displaying that, I am getting runtime error at > the line "jp.add(jsp)". I did this program in NetBeans 5.0. So kindly tell > me the sequence of steps to display the table dynamically on net beans 5.0. > > My requirement is to display the two dimensional string as content in the > table. > > Following is the program I did. > > private void btnOkActionPerformed(java.awt.event.ActionEvent evt) { > String > st[][]={{"a","b","d","d"},{"c","d","e","e"},{"e","f","s","t"},{"j","y","t","u"}}; > String st1[]={"x","y","z","s"}; > c=getContentPane(); > dft=new DefaultTableModel(); > > dft.setDataVector(st,st1); > jt=new JTable(dft); > JScrollPane jsp=new JScrollPane(jt); > // jt.setCellSelectionEnabled(true); > jp.add(jsp);// For your easy reference,I am gettig run time error in > this line > c.add(jp); > > } > > Otherwise, suggest me another way to display the table that need to take the > data from the two dimensinal arry string as conent and one dimensional > string as column heads. > > I hope that i get response soon. > > Thank u in advance. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
