Adding values to a JList
<p>I have 2 classes, a view where all my controls are placed for my gui and another one for my code.</p>

<p>But how do I add values to the <code>JList</code>? I can only do it from the GUI class (first class mentioned below) itself, but that's not a suitable spot.</p>

<h3>First class</h3>

<pre><code>private JList userList;
userList = new JList(ce.data); // where data is the datalist model in my 2nd class
</code></pre>

<h3>Second class (holds all the future calculations, arrays, etc.)</h3>

<pre><code>private String[] testList;
DefaultListModel data = new DefaultListModel();

public void AddValuesList()
{
    testList = new String[] {"user1", "user2"};

    for (int i=0; i &lt; testList.length; i++)
    {
        this.data.add(i, testLijst[i]);
    }
}
</code></pre>
