}
if (bWindow == false)
{
ChatWindow wndChat1 = new ChatWindow(xmppconnection, msg, contacts.getContact(msg.getFrom(), false));
wndChat1.setVisible(true);
andFilter.addFilter(new NotFilter(new FromContainsFilter(msg.getFrom())));
xmppconnection.addPacketListener(this, andFilter);
}
}
}
};
MouseListener mouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
String strTitle = null;
boolean bChatWindow = false;
//int index = lstContacts.locationToIndex(e.getPoint());
if (lstView.getSelectedValue() instanceof ListItem )
{
strTitle = ((ListItem) lstView.getSelectedValue()).getText();
//System.out.println("DRIN!");
for(Frame frame : JFrame.getFrames()){
if (frame.getTitle().equals(strTitle))
{
bChatWindow = true;
frame.setVisible(bChatWindow);
break;
}
}
if (bChatWindow == false)
{
if(contacts.getContact(strTitle,false) != null){
contact = contacts.getContact(strTitle,false);}
else{
contact = contacts.getContact(strTitle,true);}
ChatWindow wndChat = new ChatWindow(xmppconnection, contact);
Observer observer = wndChat;
contact.addObserver(observer);
andFilter.addFilter(new NotFilter(new FromContainsFilter(contact.getFullJID())));
xmppconnection.addPacketListener(pktListener, andFilter);
wndChat.setVisible(true);
}
}
}