The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Refreshing Display of JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Refreshing Display of JTable" Watch "Refreshing Display of JTable" New topic
Author

Refreshing Display of JTable

David Reck
Ranch Hand

Joined: May 25, 2001
Posts: 37
I am using a JTable with a class I wrote exteding AbstractTableModel for the data model. When I perform a search on the gui I update the data in the model, but to get the new search results to be displayed I have to click on a column header on the table. Then the results are displayed correctly. I have tried to call repaint() and updateGUI() on the table to refresh the view after the search but I get null pointer exception on both of them. What is the proper way to refresh the display of data from the updated values in the model on the JTable?
Thanks,
Dave
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Remember to call fireTableDataChanged() in your AbstractTableModel subclass when you update the data it holds...
Hope this helps!!!
Benjam�n
Ravikiran Choppalli
Ranch Hand

Joined: Nov 18, 2000
Posts: 49
Have a update() function in your customtablemodel class, pass the data that needs to be updated and call fireTableDataChanged(). This WORKS.


Thanks,<BR>Ravikiran<BR>rkchoppalli@yahoo.com
 
 
subject: Refreshing Display of JTable
 
IntelliJ Java IDE