This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes can't get to distribute my individual datas into row in 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 » Swing / AWT / SWT
Bookmark "can Watch "can New topic
Author

can't get to distribute my individual datas into row in JTable

joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
hi everybody in the house
i am try to insert datas from database into Jtable rows, that is i want to add another row to the bottom of my table
the issue is these
i use vector utility to collate my datas from the database then add it to the table, ok fine!! i got the datas into my vector and add, but instead of it distributing it to different cells, it only add to a particular cell which is not what i want.
take a look into my code.
this is working mechine to get the datas from the batabase into the vector.

And this is the table adding part

please i need to know what i did wrong cause it is getting me off the edge
thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

You are treating your Vector of Vectors, which should be your model's entire data set, as a simple row Vector. You should iterate over this Vector, adding each Vector separately.

And instead of using insertRow you can use addRow to add a row to the end.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
please can you write an example short code to show this
thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

I'm sure you can write a simple loop and the casting of each element to Vector yourself, can't you?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can't get to distribute my individual datas into row in JTable