public void actionPerformed(ActionEvent e) {
		if (e.getSource() == connect) {
			dispose();
			try {
				IRCClient.connectTo(ip.getText(),
						Integer.parseInt(port.getText()),
						(UserSettings) userSettings.getSelectedItem());
			} catch (NumberFormatException nfe) {
				JOptionPane.showMessageDialog(this.getParent(),
						"The port must be a number between 0 and 65535",
						"Invalid port", JOptionPane.PLAIN_MESSAGE);
			} catch (UnknownHostException uhe) {
				uhe.printStackTrace();
				JOptionPane.showMessageDialog(this.getParent(),
						"Failed to find the host", "Unknown Host",
						JOptionPane.PLAIN_MESSAGE);
			} catch (ConnectException ce) {
				ce.printStackTrace();
				JOptionPane.showMessageDialog(this.getParent(),
						"Failed to establish a connection to " + ip.getText()
								+ " : " + port.getText(), "Connection failed",
						JOptionPane.PLAIN_MESSAGE);
			} catch (Exception ex) {
				ex.printStackTrace();
				JOptionPane.showMessageDialog(this.getParent(),
						"Uncaught Exception", "Uncaught exception: " + ex,
						JOptionPane.PLAIN_MESSAGE);
			}
		} else if (e.getSource() == cancel) {
			dispose();
		}
	}