aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Unknown number of rows to create a JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Unknown number of rows to create a JTable" Watch "Unknown number of rows to create a JTable" New topic
Author

Unknown number of rows to create a JTable

Aj Maffei
Greenhorn

Joined: Jun 18, 2009
Posts: 2
I am currently working on a project that requires me to have a JTable with 6 collums but a variable amount of rows. I know that you can use DefaultTableModel.addRow(), but the problem is that i am using NetBeans IDE to auto generate the GUI and it will not let me use the DefaultTableModel.

The auto generated code for the table is as follows:


Keep in mind i am not an excellent programmer I am looking to learn.
Help is very much appreciated,
AJ
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2216
    
    7
jTable1.setModel(new javax.swing.table.DefaultTableModel(


According to that line of code it is using the DefaultTableModel.

You can access it in your code using:



Aj Maffei
Greenhorn

Joined: Jun 18, 2009
Posts: 2
Rob Camick wrote:
jTable1.setModel(new javax.swing.table.DefaultTableModel(


According to that line of code it is using the DefaultTableModel.

You can access it in your code using:





Simple enough... i forgot to cast it as a DefaultTableModel.
Thanks for the help!
 
jQuery in Action, 2nd edition
 
subject: Unknown number of rows to create a JTable