powered by Jive Software

Doubles from JList selection

Hi,

I have a frustrating behavior when starting a private chat from my chatroom roster.

I hold the chatroom roster on a JList and when the user clicks it she gets a private chat object. For some reason my generous client creates 2 (double) such objects. My main roster is held in a JTree so it is doing the right thing providing just one chat object.

I think it has to do with the response to JList selection that creates two actions but I saw no info on it or a way to control it.

Any one here faced a similar behavior and have a solution?

This is how I process the list selection (I implements ListSelectionListener)

/** process input (selection) from the roster list

*/

public void valueChanged(ListSelectionEvent e){

String jid = (String)rosterList.getSelectedValue();

//get a chat here!!!

client.chat(jid, StringUtils.parseResource(jid));

}

Thanks Ted

Looks like there is a cure for the doubles

/** process input (selection) from the roster list

*/

public void valueChanged(ListSelectionEvent e){

//cure for the dubbles

if(e.getValueIsAdjusting())

return;

String jid = (String)rosterList.getSelectedValue();

//get a chat here!!!

client.chat(jid, StringUtils.parseResource(jid));

}