0

I understand the MVC framework somewhat, but this one thing confuses me a little. So if I have a JComponent such as a JList or a JSpinner, then they have models to store their data. Then does each instance(object) of JList or JSpinner have its own dedicated ListModel or SpinnerModel instance?

Thank you for your help!

sarora
  • 499
  • 5
  • 20

1 Answers1

3

By default, yes. However, it is possible to share models between similar JComponents (i.e, 2 JLists can share the same ListModel). This is not typical however and you'd have to code this explicitly yourself.

splungebob
  • 5,357
  • 2
  • 22
  • 45