File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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
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
I agree. Here's the link:
subject: How can I add rows in a Jtable
It's not a secret anymore!