• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Problem Since 1 week

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • 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.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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?
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!