private void maybeShowPopup(MouseEvent e) {
			if (e.isPopupTrigger()) {
				Point eventP = e.getPoint();
				int layer = -1;
				int number = 0;
				for (int i = 0; i < ffnn.getLayers().size(); i++) {
					if (layer != -1)
						break;
					for (int j = 0; j < ffnn.getLayers().get(i)
							.getNeuronCount(); j++) {
						Point neuronP = getNeuronPoint(i, j);
						if (neuronP.distance(eventP) < neuronDiameter / 2) {
							layer = i;
							number = j;
							break;
						}
					}
				}

				if (layer == -1)
					return;

				JPopupMenu popup = new JPopupMenu();

				if (layer != 0) {
					JMenuItem thresholdChangeItem = new JMenuItem(
							"Change thershold");
					thresholdChangeItem.setName("change threshold$" + layer
							+ ":" + number);
					thresholdChangeItem
							.addActionListener(NeuralNetworkGUI.this);
					popup.add(thresholdChangeItem);
				}

				JMenu changeWeightSubMenu = new JMenu("Change weight to ...");
				changeWeightSubMenu.addActionListener(NeuralNetworkGUI.this);

				if (layer != ffnn.getLayers().size() - 1) {
					JMenuItem changeWeightItems[] = new JMenuItem[ffnn
							.getLayers().get(layer + 1).getNeuronCount()];
					for (int i = 0; i < changeWeightItems.length; i++) {
						changeWeightItems[i] = new JMenuItem("neuron " + i);
						changeWeightItems[i].setName("change weight$" + layer
								+ ":" + number + "^" + i);
						changeWeightItems[i]
								.addActionListener(NeuralNetworkGUI.this);
						changeWeightSubMenu.add(changeWeightItems[i]);
					}

					popup.add(changeWeightSubMenu);
				}

				popup.show((Component) e.getSource(), e.getX(), e.getY());
			}
		}