What is DefaultListModel
in Java? and What is its purpose?
I tried to google it but didn't get any proper explanation for it!
It works as a Model
(predefined) for JList
Swings follows MVC and DefaultListModel plays its part as M
in MVC.
There are 3 ways to create model:
DefaultListModel
Everything is pretty much taken care of by language framework.
AbstractListModel
You manage the data and invoke the "fire" methods. For this approach, you must subclass AbstractListModel
and implement the getSize
and getElementAt
methods inherited from the ListModel
interface.
ListModel
You manage everything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With