@Override
		public void actionPerformed(ActionEvent e) {
			if(connect == e.getSource())
			{
				connect();
			}
			if(leave == e.getSource())
			{
				leave();
			}
			if(quit == e.getSource()){
				leave();
				close();
				System.exit(0);
			}
			/*
			 * If the user pressed enter in the message text box.
			 */
			if(message == e.getSource())
			{
				//Retrieve the selected users from the users JList.
				Object selectedUsers[] = Users.getSelectedValues();
				ArrayList<String> recipiants = new ArrayList<String>();
				//Add it to the recipiants.
				for(int i=0; i<selectedUsers.length; i++)
				{	
					recipiants.add((String)selectedUsers[i]);
					System.out.println("adding "+ selectedUsers[i]);
				}
				//If no users are selected send to everyone.
				if(Users.getSelectedIndex() == -1)
				{
					for(int i=0; i<usersModel.size(); i++)
					{
						recipiants.add((String)usersModel.getElementAt(i));
					}
				}
				//Send the envelope.
				Envelope ev = new Envelope(name,message.getText(),recipiants);
				try {
					out.writeObject(ev);
					out.flush();
				} catch (IOException ex) {
					// TODO Auto-generated catch block
					ex.printStackTrace();
				}
				message.setText("");
				Users.clearSelection();
			}
		}