public void mouseClicked(double x, double y, int modifiers) {

		SortedSet<Net> clickedNets = new TreeSet<Net>();

		model.getNetsAtPoint(x, y, 1.0/display.getDPI(), clickedNets);

		if (manualTopology.isSelected()) {
			clearSelection();
			TopologyProcessor.mergeNets(clickedNets);
			return;
		}

		if ((selectedNet != null) && clickedNets.contains(selectedNet)) {

			Iterator<Net> it = (clickedNets.tailSet(selectedNet)).iterator();

			it.next();

			if (it.hasNext()) {
				selectedNet = it.next();
			} else {
				selectedNet = clickedNets.iterator().next();
			}

		} else {

			selectedNet = null;

			if (!clickedNets.isEmpty()) {
				selectedNet = clickedNets.iterator().next();
			}
		}

		Net selectedNetSave = selectedNet;

		if (!((modifiers & MouseEvent.CTRL_DOWN_MASK) != 0))
			clearSelection();

		selectedNet = selectedNetSave;

		if (selectedNet != null) {
			selectedNets.add(selectedNet);
			selectedNet.setHighlighted(true);
		}
	}