@Override
		public void actionPerformed(ActionEvent e) {

			if (e.getSource() == chatField) {
				if (cc != null) {
					try {
						cc.send(chatField.getText());
						chatField.setText("");
						chatField.requestFocus();
					} catch (IOException ex) { ex.printStackTrace(); }
				}


			} else if (e.getSource() == connect) {
				connect.setEnabled(false);
				uriField.setEditable(false);
				try {
					cc = new ChatClient(new URI(uriField.getText()), area, WebSocketDraft.DRAFT76);
					cc.connect();
				} catch (URISyntaxException ex) {
					area.append(uriField.getText() + " is not a valid WebSocket URI\n");
					connect.setEnabled(true);
					uriField.setEditable(true);
				}
			} else if (e.getSource() == close) {
				try {
					cc.close();
				} catch(Exception ex) {
					ex.printStackTrace();
				}
			}
		}