You have two ways to do this:
1) In your code, list.setModel () is called manually anywhere after calling initComponents (). 2) Do it through NetBeans. Right-click the list, go to "Configure Code." The first section of code is a call to the list constructor. Change the Default Code drop-down list to Custom Creation and just paste your list into the constructor call. You can do this by installing it on a new one.
javax.swing.JList(new DefaultListModel())
or by creating an instance of listmodel before calling initComponents () in the code, and then do
javax.swing.JList(defaultModel);
Jason nichols
source share