public NodeInfoDialog(GUI p, Node n){
		super(p, "Edit Node "+n.ID, true);
		GuiHelper.setWindowIcon(this);
		parent = p;
		node = n;
		
		node.highlight(true);
		
		this.setLayout(new BorderLayout());
		
		JPanel nodeSelAndPosition = new JPanel();
		nodeSelAndPosition.setLayout(new BorderLayout());
		
		JPanel nodeSel = new JPanel();
		
		//evaluate whether a node is the first or the last in the enumeration and thus has no
		//previous respective next element.
		boolean hasPrev = false;
		Enumeration<Node> nodesEnumer = Runtime.nodes.getNodeEnumeration();
		while(nodesEnumer.hasMoreElements()){
			Node nd = nodesEnumer.nextElement();
			if(nd.ID == n.ID){
				if(!nodesEnumer.hasMoreElements()){
					nextNode.setEnabled(false);
				}
				prevNode.setEnabled(hasPrev);
				break;
			}
			hasPrev = true;
		}
		
		prevNode.addActionListener(this);
		nodeNumber.setColumns(6);
		nodeNumber.setValue(new Integer(node.ID));
		nodeNumber.addPropertyChangeListener("value", this);
		nextNode.addActionListener(this);
		nodeSel.add(prevNode);
		nodeSel.add(nodeNumber);
		nodeSel.add(nextNode);
		this.add(nodeSel);
		
		Position pos = node.getPosition();
		
		positionX.setText(String.valueOf(pos.xCoord));
		positionY.setText(String.valueOf(pos.yCoord));
		positionZ.setText(String.valueOf(pos.zCoord));
		
		JPanel position = new JPanel();
		position.setBorder(BorderFactory.createTitledBorder("Position"));
		position.setLayout(new BoxLayout(position, BoxLayout.Y_AXIS));
		position.setPreferredSize(new Dimension(80, 80));
		
		position.add(positionX);
		position.add(positionY);
		if(Configuration.dimensions == 3){
			position.add(positionZ);
		}
		
		nodeSelAndPosition.add(BorderLayout.NORTH, nodeSel);
		nodeSelAndPosition.add(BorderLayout.SOUTH, position);
		
		this.add(BorderLayout.NORTH, nodeSelAndPosition);
		
		JPanel info = new JPanel();
		info.setBorder(BorderFactory.createTitledBorder("Node Info"));
		info.setLayout(new BoxLayout(info, BoxLayout.Y_AXIS));
		this.add(BorderLayout.CENTER, info);
		
		JPanel infoPanel = new JPanel();
		NonRegularGridLayout nrgl = new NonRegularGridLayout(6, 2, 5, 5);
		nrgl.setAlignToLeft(true);
		infoPanel.setLayout(nrgl);
		info.add(infoPanel);
		
		UnborderedJTextField typeLabel = new UnborderedJTextField("Node Implementation:", Font.BOLD);
		implementationText.setText(Global.toShortName(node.getClass().getName()));
		implementationText.setEditable(false);
		infoPanel.add(typeLabel);
		infoPanel.add(implementationText);
		
		UnborderedJTextField connectivityLabel = new UnborderedJTextField("Node Connectivity:", Font.BOLD);
		connectivityText.setText(Global.toShortName(node.getConnectivityModel().getClass().getName()));
		connectivityText.setEditable(false);
		infoPanel.add(connectivityLabel);
		infoPanel.add(connectivityText);
		
		UnborderedJTextField interferenceLabel = new UnborderedJTextField("Node Interference:", Font.BOLD);
		interferenceText.setText(Global.toShortName(node.getInterferenceModel().getClass().getName()));
		interferenceText.setEditable(false);
		infoPanel.add(interferenceLabel);
		infoPanel.add(interferenceText);
		
		UnborderedJTextField mobilityLabel = new UnborderedJTextField("Node Mobility:", Font.BOLD);
		mobilityText.setText(Global.toShortName(node.getMobilityModel().getClass().getName()));
		mobilityText.setEditable(false);
		infoPanel.add(mobilityLabel);
		infoPanel.add(mobilityText);
		
		UnborderedJTextField reliabilityLabel = new UnborderedJTextField("Node Reliability:", Font.BOLD);
		reliabilityText.setText(Global.toShortName(node.getReliabilityModel().getClass().getName()));
		reliabilityText.setEditable(false);
		infoPanel.add(reliabilityLabel);
		infoPanel.add(reliabilityText);
		
		infoText.setText(node.toString());
		JLabel infoTextLabel = new JLabel("Info Text:");
		infoText.setEditable(false);
		infoText.setBackground(infoTextLabel.getBackground());
		infoPanel.add(infoTextLabel);
		infoPanel.add(infoText);
		
		JPanel buttons = new JPanel();
		
		ok.addActionListener(this);
		buttons.add(ok);
		
		cancel.addActionListener(this);
		buttons.add(cancel);
		
		this.add(BorderLayout.SOUTH, buttons);
		
		WindowListener listener = new WindowAdapter(){
			public void windowClosing(WindowEvent event){ 
				node.highlight(false);
				parent.redrawGUI(); 
			}
		};
		this.addWindowListener(listener);
		
		this.setResizable(true);
		this.getRootPane().setDefaultButton(ok);
		
		// Detect ESCAPE button
		KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
		focusManager.addKeyEventPostProcessor(new KeyEventPostProcessor() {
			public boolean postProcessKeyEvent(KeyEvent e) {
				if(!e.isConsumed() && e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ESCAPE) {
					node.highlight(false);
					NodeInfoDialog.this.setVisible(false);
					parent.redrawGUINow(); // needs blocking redrawing
				}
				return false;
			}
		});
		
		//Redraw the graph to have the selected node painted in the right color.
		parent.redrawGUI();
		this.pack();
		this.setLocationRelativeTo(p);
		this.setVisible(true);
	}