This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

TableModel removal

 
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.

 
Rancher
Posts: 3063
23
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!