// From Lay Networks.com import java.awt.TextArea; import java.awt.TextComponent; class DocText extends TextArea { DocText() { super(5, 2); doc = info + drawnodes + rmvnodes + mvnodes + startnode + drawarrows + weight + rmvarrows + clrreset + runalg + step + example + exitbutton; setText(doc); } public void showline(String s) { if(s.equals("draw nodes")) setText(drawnodes); else if(s.equals("remove nodes")) setText(rmvnodes); else if(s.equals("move nodes")) setText(mvnodes); else if(s.equals("the startnode")) setText(startnode); else if(s.equals("draw arrows")) setText(drawarrows); else if(s.equals("change weights")) setText(weight); else if(s.equals("remove arrows")) setText(rmvarrows); else if(s.equals("clear / reset")) setText(clrreset); else if(s.equals("run algorithm")) setText(runalg); else if(s.equals("step through")) setText(step); else if(s.equals("example")) setText(example); else if(s.equals("exit")) setText(exitbutton); else if(s.equals("all items")) setText(doc); else if(s.equals("toclose")) setText(toclose); else if(s.equals("done")) setText(done); else if(s.equals("locked")) setText(locked); else if(s.equals("maxnodes")) setText(maxnodes); else if(s.equals("none")) setText(none); else if(s.equals("some")) setText(some); else setText(s); } final String drawnodes = new String("DRAWING NODES:\nDraw a node by clicking the mouse.\n\n"); final String rmvnodes = new String("REMOVE NODES:\nTo remove a node press and click on the node.\nYou can not remove the startnode.\nSelect another startnode, then you can remove the node.\n\n"); final String mvnodes = new String("MOVING NODES\nTo move a node press , click on the node,\nand drag it to its new position.\n\n"); final String startnode = new String("STARTNODE:\nThe startnode is blue, other nodes are grey.\nThe first node you draw on the screen will be the startnode.\nTo select another startnode press , click on the startnode,\nand drag the mouse to another node.\nTo delete the startnode, first select another startnode, and then\nremove the node the usual way.\n\n"); final String drawarrows = new String("DRAWING ARROWS:\nTo draw an arrow click mouse in a node,and drag it to another node.\n\n"); final String weight = new String("CHANGING WEIGHTS:\nTo change the weight of an arrow, click on the arrowhead and drag\nit along the arrow.\n\n"); final String rmvarrows = new String("REMOVE ARROWS:\nTo remove an arrow, change its weight to 0.\n\n"); final String clrreset = new String(" BUTTON: Remove the current graph from the screen.\n BUTTON: Remove the results of the algorithm from the graph,\n and unlock screen.\n\n"); final String runalg = new String(" BUTTON: Run the algorithm on the graph, there will be a time\ndelay of +/- 1 second between steps.\nTo run the algorithm slower, use .\n"); final String step = new String(" BUTTON: An opportunity to step through the algorithm.\n"); final String example = new String(" BUTTON: Displays a graph on the screen for you.\nYou can then use or \n"); final String exitbutton = new String(" BUTTON: Only works if applet is run with appletviewer.\n"); final String toclose = new String("ERROR: This position is to close to another node/arrow.\n"); final String done = new String("Algorithm has finished, follow orange arrows from startnode to any node to get\nthe shortest path to the node. The length of the path is written in the node.\npress to reset the graph, and unlock the screen."); final String some = new String("Algorithm has finished, follow orange arrows from startnode to any node to get\nthe shortest path to the node. The length of the path is written in the node.\nThere are no paths from the startnode to any gray node.\npress to reset the graph, and unlock the screen."); final String none = new String("Algorithm has finished, there are no nodes reachable from the start node.\npress to reset the graph, and unlock the screen."); final String maxnodes = new String("ERROR: Maximum number of nodes reached!\n\n"); final String info = new String("DOCUMENTATION:\nYou can scroll through the documentation or get documentation\non a specific item by selecting the item on the left.\nSelecting brings you back to the scrolling text.\n\n"); final String locked = new String("ERROR: Keyboard/mouse locked for this action.\nEither press or .\n"); final String doc; }