• 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

how to update table after search

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
can somebody tell me how to update table after a search button is pressed. I am using AbstactTableModel for my JTable.
Thanks
venkat
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use
fireTableDataChanged() or one of the fireXXX methods of AbstractTableModel.
 
Varaku Venkata
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Raphael,
can you explain in some more detail..
Thanks for replying...
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Heres how I did it,
I have class that extends JPanel displaying results. It has a method that takes an array of DataInfo[] and sets the result accordingly. The class that searches the DB recieves a reference of this and calls the method
Hope that isnt too confusing
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well,
When you implement the AbstractTableModel, the method getValueAt tells you table model which Vector or Array of Strings to use for the Table Data. So like in Observer/Observable, the way you notify any changes to the table model is by using the fireXXX methods (instead of setChanged(); notifyObservers()
Hope this helps
 
Varaku Venkata
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Robert and Raphael,
I have used fireTableUpdated method and was able to update the table with the new row values..
Have a Nice Day
 
reply
    Bookmark Topic Watch Topic
  • New Topic