Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can you write an example short code to show this
thanks
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure you can write a simple loop and the casting of each element to Vector yourself, can't you?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic