previous | start | next

## Add New Node

    public void mousePressed(MouseEvent event)
    {
       Point2D mousePoint = event.getPoint();
       Object tool = toolBar.getSelectedTool();
       ...
       if (tool instanceof Node)
       {
          Node prototype = (Node) tool;
          Node newNode = (Node)prototype.clone();
          graph.add(newNode, mousePoint);
       }
       ...
       repaint();
    }

previous | start | next