JList

To programmatically populate the list models of a JList called lstNames:

import javax.swing.DefaultListModel;
import javax.swing.JList;
//...
 
    private void btnTestActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        populateList();
    }                                       
 
    private void populateList() {
        // TODO add your handling code here:
        DefaultListModel listModel = new DefaultListModel();
        listModel.addElement("Jane Doe");
        listModel.addElement("John Smith");
        listModel.addElement("Kathy Green");
 
        lstNames.setModel(listModel);
    }