Updating a TextArea via setText clears all text
<p>I made a chatroom, server and client, in java.</p>

<p>Here is the code were my onlinelist messes up:</p>

<pre><code>public void run() {
    try {
        while (true) {
            String message = din.readUTF();
            if (message.startsWith("CONNECTEDLISTEDWOOOOOOOOT")) {
                ConnectedList con = new ConnectedList();
                if (demanded == 1) {
                    con.ta.setText(message.substring(26));
                    con.setSize(200, 400);
                    con.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    con.setVisible(true);
                    demanded = 0;
                } else {
                    con.ta.setText(message.substring(26));
                }
            } else {
                ta.append(message+"\n");
                if(!lol.isActive()) {
                    InputStream in = getClass().getResourceAsStream("bleep.wav");
                    AudioStream as = new AudioStream(in);         
                    AudioPlayer.player.start(as);   
                }
            }
        }
    } catch(IOException ie) { System.out.println(ie); }
}
</code></pre>

<p>this block of code works perfectly: </p>

<pre><code>if (demanded == 1) {
        con.ta.setText(message.substring(26));
        con.setSize(200, 400);
        con.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        con.setVisible(true);
        demanded = 0;
}
</code></pre>

<p>It creates a new window using JFrame just with a textlabel(ta) with all connected users on it, also demanded just controls wether the frame is already opened or not.</p>

<p>Then the part were it gets messed up:</p>

<pre><code> else {
      con.ta.setText(message.substring(26));
 }
</code></pre>

<p>Here it's just supposed to refresh the list by setting the text to the new list
but instead of doing that, it just wipes the window.</p>

<p>How can I fix it?</p>

<h2>Before:</h2>

<p><img src="http://i.stack.imgur.com/uM5sv.png" alt="enter image description here"></p>

<h2>After:</h2>

<p><img src="http://i.stack.imgur.com/WBqKC.png" alt="enter image description here"></p>
