next up previous contents
Next: GraphControlPanel & GraphPanel Interdependency Up: GraphControlPanel Class Previous: GraphControlPanel Class

GUI Controls

The GraphControlPanel class provides a variety of GUI controls. All of the controls except the mainB button generate events handled by the GraphControlPanel. The mainB button allows the GraphControlPanel to be swapped in and out of the NetWorKsPanel as needed. This button is passed in as a constructor argument and is displayed on the GraphControlPanel. Events generated by the mainB button are ignored so that the event will propagate to the NetWorksPanel, which handles the event by swapping out the GraphControlPanel. This method assures that the GraphControlPanel class does know require any knowledge of the NetWorKsPanel class.

The remaining buttons allow the user to: switch back and forth between the directed and undirected graphs, clear the current graph, or reset the values for a selected Edge or Vertex to defaults. The logic for handling each of these events is simple, although the clear button should probably invoke an ``Are you sure?'' dialog.

Scrollbars seemed like a good way to allow users to edit values, but with so many values to edit there was not enough room to have separate scrollbars for each data value. Another space consideration was that Checkbox controls would allow the user to choose to display or not display any subset of these values at any time. So when first considering how to allow users to edit data values, it seemed that the only alternative was to use Java awt TextArea objects. But after writing and debugging the code, it was observed that the TextArea objects have no method for hiding their text cursor. This made it very difficult to see a 1 in a TextArea. This was particularly annoying since 1 would be a very common edge weight. Another difficulty with using the TextArea objects was that it would require error checking all the entries. Also, TextArea objects require the user to repeatedly access the keyboard--which directly violates one of the project objectives.

The solution devised for numeric data entry is to use a single Scrollbar object tied to a set of selectable NumberLabel objects. To change the value of a NumberLabel, the user clicks on the NumberLabel and then adjusts the number using the Scrollbar. The NumberLabel class is based on the idea of a SelectableLabel found in graphic JAVA [4]. The NumberLabel objects are tied together by a NumberLabelGroup which limits the user to selecting at most one NumberLabel from a NumberLabelGroup. Each NumberLabel is also tied to a Checkbox object which allows the user to indicate which data values should be displayed. Deselecting a Checkbox also hides the corresponding NumberLabel.

The only remaining control is a TextArea which allows users to relabel Vertex objects. It is the only control which requires the use of the keyboard.


next up previous contents
Next: GraphControlPanel & GraphPanel Interdependency Up: GraphControlPanel Class Previous: GraphControlPanel Class

Kelly Waters
Mon Oct 27 18:18:15 EST 1997