Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple models for 1 view in JTable

 
Sowjanya Raghu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to have more than one model for 1 view in JTable.
The view toggles between the models depending on the requirement.
 
Nathanael Ulrick
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, but you'd need to implement your own custom TableModel, which passes data to and from the JTable and the appropriate model. Whenever you change the view, firing an appropriate TableModelEvent will cause the JTable to update.
 
Sowjanya Raghu
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!