Hi guys,

I am in the middle of creating a chat client, below is a list of what i've created so far:
-LoginUI: usernametxt....password and a login button
-MainUI: status of the user[available, away etc] and JTree which displays...users who are online.
-ChatUI: JTextArea for composing messages(composeBox) and JTextArea for displaying the messages send/received(convBox)
I am able to login using a valid information and show users who are online on a "JTree" in the MainUI. I can doubleClick on the user that i want to chat with, doing so will show the ChatUI.

But my main problem is that, if i want to chat with another user who is online on another client...using the ChatUI.

Here is the code that I am using:

Java Code:
public class ChatUI extends javax.swing.JFrame implements MessageListener {

    private LoginUI log = new LoginUI();
    XMPPConnection connection = log.getConnection();
    String msgLine;
    String msgTo;

    /** Creates new form ChatUI */
    public ChatUI()  {

    private void sendMessage(java.awt.event.ActionEvent evt) {                             
        //to be implented
            msgLine = composeBox.getText();
            while(msgLine != null){
                 sendMessage(msgLine, msgTo);[COLOR="Red"]<--msgTo: can't figure out how to get the user from the other class "MainUI"[/COLOR]

public void sendMessage(String message, String to) throws XMPPException
        Chat chat = connection.getChatManager().createChat(to, this);

    public void processMessage(Chat chat, Message msg) {
       if(msg.getType() == Message.Type.chat){
           convBox.setText(chat.getParticipant() + " says: " + msg.getBody());

All i would like to know is...from the MainUI "JTree-which displays users who are online", once i double click on a user... how can i carry that user to the ChatUI class and use the same user to chat with him/her?

Pls help, as i've been trying this for long time...

P.S. I tried using the Netbeans console + buffereader/inputstreamreader to let the user type in the user that he/she want to talk to (by typing their full address i.e user@jabber.org) and that works fine but instead of using the console i wanted to use the interface...

Thanks in advance