You can add items to your model using the addElement() method. How to Initialize and Select List Items in a Java Model Here is an example of its syntax in Java: DefaultListModel fruits = new DefaultListModel() // sample usage The examples in this tutorial will be using the DefaultListModel. JList models allow your program to keep track of items added to – or selected on – the list.
0 Comments
Leave a Reply. |