Adding and removing list items

Adding items to a list is done by creating a ListModel and adding it to the List, either when initiating a List or by using the method setModel(ListModel model). To remove an item or all items from a List, use removeItem(int index) or removeAll() methods. For example:

// Adding to a list either by using the DefaultListModel snipped code, or:
....
myListModel.addItem("New Item");

// Removing is done either by:
....
myListModel.removeItem(index);
// or:
myListModel.removeAll();