The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Re: Refreshing a JTable

Posted by Brian Sanders on November 29, 2001 at 11:00 AM

I can change the data set according to the input, but I cannot refresh the output on the GUI. I just wonder should I add a TableModelListener to the model so that I can refresh the data and where should I add the Listener?

When you modify the data in a subclass of AbstractTableModel, call the appropriate fire*() method. You'll probably want to call either fireTableDataChanged() or fireTableStructureChanged(). This will notify the GUI that it needs to repaint itself.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us