// From Lay Networks.com import java.awt.*; class DocOptions extends Panel { DocOptions(Documentation documentation, BellmanFord bellmanford) { doc = new Choice(); doc2 = new Choice(); setLayout(new GridLayout(3, 1, 5, 0)); grandparent = bellmanford; parent = documentation; add(new Label("DOCUMENTATION:")); doc.addItem("draw nodes"); doc.addItem("remove nodes"); doc.addItem("move nodes"); doc.addItem("the startnode"); doc.addItem("draw arrows"); doc.addItem("change weights"); doc.addItem("remove arrows"); doc.addItem("clear / reset"); doc.addItem("run algorithm"); doc.addItem("step through"); doc.addItem("example"); doc.addItem("exit"); doc.addItem("all items"); add(doc); doc2.addItem("Choose Example: "); doc2.addItem("Example1:"); doc2.addItem("Example2:"); doc2.addItem("Example3:"); add(doc2); } public boolean action(Event event, Object obj) { if(event.target instanceof Choice) { String s = new String(doc.getSelectedItem()); parent.doctext.showline(s); } if(event.target instanceof Choice) { String s1 = new String(doc2.getSelectedItem()); if(s1.equals("Example1:")) grandparent.graphcanvas.showexample1(); else if(s1.equals("Example2:")) grandparent.graphcanvas.showexample2(); else if(s1.equals("Example3:")) grandparent.graphcanvas.showexample3(); } return true; } Choice doc; Choice doc2; Documentation parent; BellmanFord grandparent; }