aspose file tools*
The moose likes Java in General and the fly likes How can I add rows in a Jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How can I add rows in a Jtable " Watch "How can I add rows in a Jtable " New topic
Author

How can I add rows in a Jtable

ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
Hello All,
I read in a csv file then I put that file in Vector v, and the call the vector.size method and put the size of the vector into a int called num2. now I want to be able to set up the rows so that the rows are the size of the file. ie if the v.size()(num2) is 10 I want the rows in the JTable to resize to that.
Can anyone help please
Thanks
Ben
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I think this thread is duplicated and I replied to your questions as much as I can in the other thread...
I'm wondering why u posted a new thread with the same topic???
By the way, u might want to try the following constructor to set the initial cells in the table...
int numberOfRows = getNumberOfRowsFromSomewhere();
int numberOfColumns = getNumberOfColumnsFromSomewhere();
JTable table = new JTable(numberOfRows, numberOfColumns);
Hope this helps a bit...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How can I add rows in a Jtable