previous | start | next

## Adding Nodes and Edges

- Objects are more flexible than classes
- `new CircleNode(Color.BLACK)
  new CircleNode(Color.WHITE)`
- When user inserts new node, the toolbar node is cloned
  `Node prototype = node of currently selected toolbar button;
  Node newNode = (Node) prototype.clone();
  Point2D mousePoint = current mouse position;
  graph.add(newNode, mousePoint);`
- Example of PROTOTYPE pattern

previous | start | next