简体   繁体   中英

Does each JSpinner object have its own Model object?

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM