Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TableModel removal  RSS feed

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 different bespoke table models.

When one is needed I simply add it to the table. In this case however whilst updating the model via table update in tableChanged method I have the impression of 2 identical models because the update happens twice (use of audio).
Is it not true that adding a new model cancels out the other ? I test for which model is attached to table and add the correct one depending on the data required.

 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whilst updating the model via table update in tableChanged


You update the data in the TableModel by using methods like addRow(...), setValueAt(...).

The TableModel then invokes methods like tableChanged() to notify the JTable that the data has changed so the view can repaint itself.

Is it not true that adding a new model cancels out the other ?


A view (JTable) can only have a single model (TableModel). However a model can be shared by multiple views.

I have the impression of 2 identical models because the update happens twice (use of audio).


Post your SSCCE that demonstrates the problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!