The GraphPanel and GraphControlPanel classes work together to provide a GUI for creating and editing graphs. The GraphControlPanel class provides controls which allow users to edit properties of the Graph, Vertex and Edge objects contained in a GraphPanel. The GraphPanel class provides a drawing space in which a user may add, move, or delete Edge and Vertex objects from either a SimpleGraph or a SimpleUndirectedGraph. Note that a GraphControlPanel does not contain a GraphPanel. The NetWorKsPanel creates a GraphPanel and then creates a GraphControlPanel which attaches itself to the GraphPanel. A GraphControlPanel cannot function without an attached GraphPanel; however, a GraphPanel can function with or without a GraphControlPanel.
There are a number of reasons for writing a GraphControlPanel class instead of adding the same functionality to the GraphPanel class. The foremost of these is that the controls necessary to edit the graph are not needed when running a algorithm. Placing these controls in a separate panel allows the controls to be hidden while still displaying the graph. This separation is also logical in that the events generated to create, move, and delete Vertex and Edge objects are recognized by evaluating the pointing cursor location. By contrast, an editing control event is recognized by comparing the target of the event with each of the editing control objects.
The discussions of the GraphControlPanel and GraphPanel classes consider implications and complications of this decision.