@Override
	public void actionPerformed(final ActionEvent event) {

		if (event.getSource() == this.okButton) {
			if (this.saveConfiguration()) {
				this.dispose();
			} else {
				JOptionPane.showMessageDialog(this, this.resourceBundle
						.getString("dialog.saveFailed"), this.resourceBundle
						.getString("dialog.saveFailed.title"),
						JOptionPane.ERROR_MESSAGE);
			}
		} else if (event.getSource() == this.cancelButton) {
			this.dispose();
		} else if (event.getSource() == this.addListenButton) {
			final String address = this.listenAddressTextField.getText();
			final String port = this.listenPortTextField.getText();

			List<Listen> list = this.configuration.getListen();
			if (list == null) {
				list = new ArrayList<Listen>();
				this.configuration.setListen(list);
			}

			final Listen listen = new Listen();
			listen.setAddress(address);

			try {
				listen.setPort(Integer.parseInt(port));
			} catch (final NumberFormatException e) {
				listen.setPort(1080);
			}

			list.add(listen);

			this.reloadListenBox();

		} else if (event.getSource() == this.removeListenButton) {
			final int index = this.listenList.getSelectedIndex();

			if (index != -1) {
				this.configuration.getListen().remove(index);
				this.reloadListenBox();
			}
		}
	}