This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 2152
    
    7


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:


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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unknown number of rows to create a JTable
 
Similar Threads
jtable
How to add rows to jTable dynamically?
Tab order in JTable
JTable numeric validation
Problem Updating Content Of JTable