Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable refresh?  RSS feed

 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey again
Is there any method to refresh a table that it shows all actual contents from its model?
Thanks
Florian Meyer
 
Jack Conway
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Not sure if this is what you need, because it answers the question from the other direction. The method fireTableDataChanged in your model (assuming you have inherited from AbstractTableModel) will notify the table that it must redraw itself...
public void fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.
[ December 16, 2003: Message edited by: Jack Conway ]
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JTable listens for changes to it's model through the javax.swing.event.TableModelListener interface. If you are using javax.swing.table.AbstractTableModel or its subclasses, you can use the convenient fireTable*() methods to inform the JTable of changes to the model.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!