@Override
	public void mousePressed(MouseEvent e) {
		if (selectedOC != null) {
			if (enteredIC != null) {
				try {
					selectedOC.addConnected(enteredIC);
					selectedOC.setSelected(false);
					selectedOC = null;
					enteredIC.setSelected(false);
					enteredIC = null;
					repaint();
				} catch (ConnectException e1) {
					JOptionPane.showMessageDialog(null, e1.getMessage());
				}
			} else {
				selectedOC.setSelected(false);
				selectedOC = null;
				repaint();
			}
		} else if (e.isPopupTrigger()) {
			for (Component ele : elements) {
				if (ele.contains(e.getPoint())) {
					setSelected(ele);
					ele.showMenu(e.getX(), e.getY());
					changed();
					break;
				}
			}
		} else {
			mxSave = e.getX();
			mySave = e.getY();
			Component tmp = null;
			for (Component ele : elements) {
				if (ele.isInside(mxSave, mySave)) {
					tmp = ele;
					break;
				}
			}
			setSelected(tmp);
			repaint();
		}
	}