my dog learned polymorphism
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
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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: 19232

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
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: 19232

I'm sure you can write a simple loop and the casting of each element to Vector yourself, can't you?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: can't get to distribute my individual datas into row in JTable
 
Similar Threads
iscelleditable is not working in jtable
Columns on JTable
Getting Last Record in Jtable
Jtable showing last record only
add an empty row to the Jtable