protected void drawNode(Graphics g, int iNode, int mode) {
			int nPosX = m_BayesNet.getPositionX(iNode);
			int nPosY = m_BayesNet.getPositionY(iNode);
			g.setColor(this.getBackground().darker().darker());
			FontMetrics fm = getFontMetrics(getFont());
			
			if (mode == HIGHLIGHTED) {
				g.setXORMode(Color.green); // g.setColor(Color.green);
			}
			g.fillOval(nPosX + m_nPaddedNodeWidth - m_nNodeWidth - (m_nPaddedNodeWidth - m_nNodeWidth) / 2, nPosY,
					m_nNodeWidth, m_nNodeHeight);
			g.setColor(Color.white);
			if (mode == HIGHLIGHTED) {
				g.setXORMode(Color.red);
			}

			// Draw the node's label if it can fit inside the node's
			// current width otherwise just display its node nr
			// if it can fit in node's current width
			if (fm.stringWidth(m_BayesNet.getNodeName(iNode)) <= m_nNodeWidth) {
				g.drawString(m_BayesNet.getNodeName(iNode), nPosX + m_nPaddedNodeWidth / 2
						- fm.stringWidth(m_BayesNet.getNodeName(iNode)) / 2, nPosY + m_nNodeHeight / 2
						+ fm.getHeight() / 2 - 2);
			} else if (fm.stringWidth("" + iNode) <= m_nNodeWidth) {
				g.drawString("" + iNode, nPosX + m_nPaddedNodeWidth / 2 - fm.stringWidth("" + iNode) / 2, 
						nPosY + m_nNodeHeight / 2 + fm.getHeight() / 2 - 2);
			}

			if (mode == HIGHLIGHTED) {
				g.setXORMode(Color.green);
			}

			if (m_bViewMargins) {
				if (m_BayesNet.getEvidence(iNode) < 0) {
					g.setColor(new Color(0, 128, 0));
				} else {
					g.setColor(new Color(128, 0, 0));
				}
				double[] P = m_BayesNet.getMargin(iNode);
				for (int iValue = 0; iValue < P.length; iValue++) {
					String sP = P[iValue] + "";
					if (sP.charAt(0) == '0') {
						sP = sP.substring(1);
					}
					if (sP.length() > 5) {
						sP = sP.substring(1, 5);
					}
					g.fillRect(nPosX + m_nPaddedNodeWidth, nPosY + iValue * 10 + 2, (int) (P[iValue] * 100), 8);
					g.drawString(m_BayesNet.getNodeValue(iNode, iValue) + " " + sP, nPosX + m_nPaddedNodeWidth
							+ (int) (P[iValue] * 100), nPosY + iValue * 10 + 10);

				}
			}
			if (m_bViewCliques) {
					return;
			}
			g.setColor(Color.black);
			// Drawing all incoming edges into the node,
			for (int iParent = 0; iParent < m_BayesNet.getNrOfParents(iNode); iParent++) {
				int nParent = m_BayesNet.getParent(iNode, iParent);
				int nPosX1 = nPosX + m_nPaddedNodeWidth / 2;
				int nPosY1 = nPosY + m_nNodeHeight;
				int nPosX2 = m_BayesNet.getPositionX(nParent);
				int nPosY2 = m_BayesNet.getPositionY(nParent);
				int nPosX2b = nPosX2 + m_nPaddedNodeWidth / 2;
				int nPosY2b = nPosY2;

				double phi = Math.atan2((nPosX2b - nPosX1 + 0.0) * m_nNodeHeight, (nPosY2b - nPosY1 + 0.0) * m_nNodeWidth);
				nPosX1 = (int) (nPosX + m_nPaddedNodeWidth / 2 + Math.sin(phi) * m_nNodeWidth / 2);
				nPosY1 = (int) (nPosY + m_nNodeHeight / 2 + Math.cos(phi) * m_nNodeHeight / 2);
				nPosX2b = (int) (nPosX2 + m_nPaddedNodeWidth / 2 - Math.sin(phi) * m_nNodeWidth / 2);
				nPosY2b = (int) (nPosY2 + m_nNodeHeight / 2 - Math.cos(phi) * m_nNodeHeight / 2);
				drawArrow(g, nPosX2b, nPosY2b, nPosX1, nPosY1);
			}
			if (mode == HIGHLIGHTED) {
			FastVector children = m_BayesNet.getChildren(iNode);
			for (int iChild = 0; iChild < children.size(); iChild++) {
				int nChild = (Integer) children.elementAt(iChild);
				int nPosX1 = nPosX + m_nPaddedNodeWidth / 2;
				int nPosY1 = nPosY;
				int nPosX2 = m_BayesNet.getPositionX(nChild);
				int nPosY2 = m_BayesNet.getPositionY(nChild);
				int nPosX2b = nPosX2 + m_nPaddedNodeWidth / 2;
				int nPosY2b = nPosY2 + m_nNodeHeight;

				double phi = Math.atan2((nPosX2b - nPosX1 + 0.0) * m_nNodeHeight, (nPosY2b - nPosY1 + 0.0) * m_nNodeWidth);
				nPosX1 = (int) (nPosX + m_nPaddedNodeWidth / 2 + Math.sin(phi) * m_nNodeWidth / 2);
				nPosY1 = (int) (nPosY + m_nNodeHeight / 2 + Math.cos(phi) * m_nNodeHeight / 2);
				nPosX2b = (int) (nPosX2 + m_nPaddedNodeWidth / 2 - Math.sin(phi) * m_nNodeWidth / 2);
				nPosY2b = (int) (nPosY2 + m_nNodeHeight / 2 - Math.cos(phi) * m_nNodeHeight / 2);
				drawArrow(g, nPosX1, nPosY1, nPosX2b, nPosY2b);
			}
			}
		}