• Post Reply Bookmark Topic Watch Topic
  • New Topic

TableModel Problems  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable with a an AbstractTableModel that I have created using Data from 2 Vectors. Below is my code for each
Getting Data from Database:

My Table Model:

How I use the TableModel

Now when the table gets created it puts all the data for each row into every Cell in that row. for example:
------------------------------------------
-[id1, name1, bla1...]-[id1, name1, bla1]-
------------------------------------------
-[id2, name2, bla2...]-[id2, name2, bla2]-
------------------------------------------
Instead of:
--------------------------------
-id1 - name1 - bla1-
--------------------------------
-id2 - name2 - bla2-
--------------------------------
Hope that makes some sense. I just don't know why it is getting dispayed that way.
Thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure either... but you shouldn't have to use AbstractTableModel... DefaultTableModel is probably what you're looking for...

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate, I will give that a shot. Sad thing is all I want to do is make the darn thing not editable.
Thanks again.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nate-
Works Great!! Perfect Solution for me.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!