title: Unable to display received messages with SMACK api in JAVA
body: <p>I have made a simple client using SMACK api and OpenFire on localhost. As of now, I have two users say X and Y. Whenever anyone logs in to the client, there is a send button which sends a message to user Y. I've checked the XMPP debug manager and I'm able to send/receive messages there. However, I'm unable to display those messages in a JLabel that I have alloted for displaying the messages. If the User Y hits the send button, as per the functionality it sends a message to himself and that comes up on the JLabel. But when user X hits the send button, the message is received, however it is not displayed/updated on the Y's JLabel.</p>
  
  <p>Interestingly, everything works as it should with gtalk configuration.</p>
  
  <p>The structure is as follows:</p>
  
  <p><strong>WelcomeUser.java:</strong>
  Is the welcome form with username and password prompt. On hitting the login button :
  it sets the ChatBoard class visible and passes on the username password to the constructor of ChatBoard.
  Code:</p>
  
  <pre><code>chBoard=new ChatBoard(username.getText(),password.getText());
                  chBoard.setVisible(true);
                  setVisible(false);
  </code></pre>
  
  <p>Here is the code for ChatBoard.java:</p>
  
  <pre><code>import java.awt.EventQueue;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.util.Collection;
  
  import javax.swing.GroupLayout;
  import javax.swing.GroupLayout.Alignment;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.JTextField;
  import javax.swing.LayoutStyle.ComponentPlacement;
  import javax.swing.border.EmptyBorder;
  
  import org.jivesoftware.smack.Chat;
  import org.jivesoftware.smack.ConnectionConfiguration;
  import org.jivesoftware.smack.MessageListener;
  import org.jivesoftware.smack.Roster;
  import org.jivesoftware.smack.RosterEntry;
  import org.jivesoftware.smack.XMPPConnection;
  import org.jivesoftware.smack.XMPPException;
  import org.jivesoftware.smack.packet.Message;
  
  public class ChatBoard extends JFrame implements MessageListener {
  
      private static final long serialVersionUID = 1L;
      private JPanel contentPane;
      static String username, password;
      static XMPPConnection connection;
      private JTextField textField;
      static JLabel board = new JLabel("");
      static Chat chat;
  
      public void sendChat() {
          try {
              chat = connection.getChatManager().createChat(
                      "userY@my-pc/Smack", this);
              chat.sendMessage("Hello, This is " + username);
          } catch (XMPPException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
  
  
      /**
       * Create the frame.
       */
      public ChatBoard(String user, String pass) {
  
          username = user;
          password = pass;
  
          ////  
                     ///JFrame creation code ommited for this thread.
          // ////////////////////////////////////////////
  
          XMPPConnection.DEBUG_ENABLED = true;
  
          ConnectionConfiguration config = new ConnectionConfiguration(
                  "127.0.0.1");
  
  
          connection = new XMPPConnection(config);
  
          try {
              connection.connect();
              System.out.println("Connected...");
          } catch (XMPPException e) {
  
              e.printStackTrace();
              System.out.println("Not Connected. Error :" + e.getMessage());
          }
  
          try {
              connection.login(username, password);
              System.out.println("Logged in...");
          } catch (XMPPException e) {
  
              e.printStackTrace();
              System.out.println("Not Logged in. Error :" + e.getMessage());
          }
  
          Roster roster = connection.getRoster();
          Collection&lt;RosterEntry&gt; entries = roster.getEntries();
  
          System.out.println("\n\n" + entries.size() + " buddy(ies):");
          for (RosterEntry r : entries) {
              System.out.println(r.getUser());
          }
  
          // /////////////////////////////////
  
      }
  
      @Override
      public void processMessage(Chat arg0, Message arg1) {
          // TODO Auto-generated method stub
  
          board.setText(board.getText() + arg1.getBody());
          System.out.println(arg1.getFrom() + ":" + arg1.getBody().toString());
  
      }
  
  }
  </code></pre>
  
  <p>I'm new to this, so forgive me if there are any silly mistakes. Your help would be really appreciated.</p>
  
  <p><strong>Misc. Details:</strong> OpenFire 3.7.1 on localhost with SMACK 3.2.2</p>