This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I have a class which implements TableModel. Inside the class i am using a JTable which has dynamic data. So i need to refresh the JTable whenever data changes. For that i am using following lines: jtable.repaint(); jtable.invalidate(); But i couldnt refresh the JTable .It is showing old data. I read somewhere that i need to refresh the "model" not the "jtable". If it is true , how to refresh TableModel? Pls suggest some solution. Appriciate any Code samples. Thanks, Raj
If you did not create your own data model, you can invoke the appropriate fireTable*() method on the data model. This will send an event to the data model's listeners (the JTable being one of them) that the data has changed. Look at the documentation for the an explanation of the various fireTable*() methods.