• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable Problem Since 1 week

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i have table which populates data from the data base now the problem is when ever i click the button the old rows are not erased from the JTable and the new once are added below them. Here is my code can any body just modify it.
Thanks and regards

i have tried using repaint() and revalidate but nothing works.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by adeeb alexander:
hi,
i have table which populates data from the data base now the problem is when ever i click the button the old rows are not erased from the JTable and the new once are added below them.



No wonder.
You are picking the existing model and adding rows to it.


What you need to do is create a new table model, populate it with data from your DB and then set it on the table.
OR
Take your existing model, delete all existing data and repopulate with new data from the DB.
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Manish can you please tell how can i delete all existing data and repopulate with new data from the DB.Please add that line of code in the code i gave before please.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by adeeb alexander:
..Please add that line of code in the code i gave before please.



I am absolutely tempted to use abusive language. You think I got nothing better to do? Have you bothered to at least go through the API before asking me to do stuff for you?
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No he hasn't.

adeeb, I've warned you before - ShowSomeEffort and SearchFirst. You still keep posting every single question you have on this board without any hint that you are even aware the API exists.
 
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic