title: Adding items to a JList from ArrayList using DefaultListModel
body: <p>I'm trying to add items that are in an <code>ArrayList</code> to a <code>JList</code> which is working when I use the following code:</p>
  
  <pre><code>private void UpdateJList(){
      DefaultListModel&lt;String&gt; model = new DefaultListModel&lt;String&gt;();
      for(Person p : personList){
          model.addElement(p.ToString());
      }
      clientJList.setModel(model);
      clientJList.setSelectedIndex(0);
  }
  </code></pre>
  
  <p>However, If I declare the <code>DefaultListModel</code> outside of the method, the adding increments each item, IE instead of adding one of each item, it adds multiple items. I was just wondering why this happens?</p>