• Post Reply Bookmark Topic Watch Topic
  • New Topic

update a JTable

 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi! I'm using NetBeans and it uses its initComponents method to initialize the components =D

in this method it executes a query and binds a JList in the JTable:


all this is inside a JFrame. In this JFrame I also have fields to insert a new record in the table.
It's working, but I don't know how to update de table, so the user can see the changes.

thanks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> In this JFrame I also have fields to insert a new record in the table.
> It's working, but I don't know how to update de table, so the user can see the changes.

can't help with any of the netbeans stuff, but if the table was setup using a DefaultTableModel (dtm), you'd just use

dtm.addRow(Object[] or Vector());

where Object[] or Vector() is the row data from your 'fields to insert a new record'
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> In this JFrame I also have fields to insert a new record in the table.
> It's working, but I don't know how to update de table, so the user can see the changes.

can't help with any of the netbeans stuff, but if the table was setup using a DefaultTableModel (dtm), you'd just use

dtm.addRow(Object[] or Vector());

where Object[] or Vector() is the row data from your 'fields to insert a new record'


thanks friend! :thumbup:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!