@Override
    public void on(String event, JSONObject obj) {
        try {
            if (event.equals("user message")) {
                MessagesTextArea.append(obj.getString("user") + ": " + obj.getString("message") + "\n");
            }

            else if (event.equals("announcement")) {
                MessagesTextArea.append(obj.getString("user") + " " + obj.getString("action") + "\n");
            }

            else if (event.equals("nicknames")) {
                JSONArray names = obj.names();
                String str = "";
                for (int i=0; i < names.length(); i++) {
                    if (i != 0)
                        str += ", ";
                    str += names.getString(i);
                }
                OnlineUsers.setText(str);
            }
        } catch (JSONException ex) {
            ex.printStackTrace();
        }
    }
@param args the command line arguments
examples/chat/ChatFrame.java