if(v.equals(_apspSource)) { JOptionPane.showMessageDialog(null, "You picked the same node " + _apspSource.id() + " to be the source and destination.", "Path Error", JOptionPane.ERROR_MESSAGE); return; }  Path p = _g.shortestPath(_apspSource, v);  if(p == null) { JOptionPane.showMessageDialog(null, "There is no path from " + _apspSource.id() + " to " + v.id() + ".", "Path Error", JOptionPane.ERROR_MESSAGE); return; }   Iterator i = _registry.getNodeItems(); PNode pnode = null; while(i.hasNext()) { pnode = (PNode) ((VisualItem) i.next()).getEntity(); pnode.setPathElement(p.contains(pnode.v()) ? true : false); pnode.setStartPoint(pnode.v().equals(p.start()) ? true : false); pnode.setEndPoint(false); } pnode.setEndPoint(true);  i = _registry.getEdgeItems(); while(i.hasNext()) { PEdge pedge = (PEdge) ((VisualItem) i.next()).getEntity(); if(p.contains(pedge.e())) { pedge.setPathElement(true); } else { pedge.setPathElement(false); } }
_apspSource = v;
				public void actionPerformed(ActionEvent e) {					Vertex v = ((PNode) _lastItemClicked.getEntity()).v();					if(v.equals(_apspSource)) {						JOptionPane.showMessageDialog(null,							"You picked the same node " + _apspSource.id() + " to be the source and destination.",							"Path Error",							JOptionPane.ERROR_MESSAGE);						return;					}					Path p = _g.shortestPath(_apspSource, v);					if(p == null) {						JOptionPane.showMessageDialog(null,							"There is no path from " + _apspSource.id() + " to " + v.id() + ".",							"Path Error",							JOptionPane.ERROR_MESSAGE);						return;					}					// run through all the visible nodes					Iterator i = _registry.getNodeItems();					PNode pnode = null;					while(i.hasNext()) {						pnode = (PNode) ((VisualItem) i.next()).getEntity();						pnode.setPathElement(p.contains(pnode.v()) ? true : false);						pnode.setStartPoint(pnode.v().equals(p.start()) ? true : false);						pnode.setEndPoint(false);					}					pnode.setEndPoint(true);					i = _registry.getEdgeItems();					while(i.hasNext()) {						PEdge pedge = (PEdge) ((VisualItem) i.next()).getEntity();						if(p.contains(pedge.e())) {							pedge.setPathElement(true);						} else {							pedge.setPathElement(false);						}					}				}