Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

update a JTable

 
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.
 
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:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!