Have you try:

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

Patrick


On Sun, 2009-03-01 at 21:32 -0800, sriramulu chittajallu 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to