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:
Everything is pretty much taken care of by language framework.
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.
You manage everything.