// ExtendedGraphCanvas.java // A subclass of GraphCanvas class defined in GraphCanvas.java import java.awt.*; import java.util.*; class ExtendedGraphCanvas extends GraphCanvas { // boolean replay_on = false; /* -------- A couple of overloaded constructors ------*/ ExtendedGraphCanvas(petrinet1 myParent, ExtendedGraphCanvas g) { /* reuse GraphCanvas constructor code by calling super parent = myParent; child = g; init(); algorithm = PETRINET; setBackground(Color.white); */ super(myParent, g); subWindows = new Vector(); } // end of constructor1 ExtendedGraphCanvas(petrinet1 myParent) { /* reuse GraphCanvas constructor code by calling super parent = myParent; init(); algorithm = PETRINET; setBackground(Color.white); */ super(myParent); subWindows = new Vector(); } // end of constructor2 // method addSubWindow public void addSubWindows(Object subWindow) { subWindows.addElement(subWindow); } /**************************************/ // method of replay public void replay() { Vector replay = new Vector(); for (int i = 0; i < replayVector.size(); i++) replay.addElement(replayVector.elementAt(i)); replayVector.removeAllElements(); parent.Egraphcanvas.repaint(); // clears all things on screen for (int i = 0; i < replay.size(); i++) { replayVector.addElement(replay.elementAt(i)); try { Thread.sleep(1000); } catch (InterruptedException e) { } parent.Egraphcanvas.repaint(); } Replay = false; } // end of ExtendedGraphCanvas.replay() //overwriting super.keydown public boolean keyDown(Event evt, int key) { if(key == Event.F1) Replay = true; else { sessionStart = true; keyValue = key; boolean shiftPressed = (evt.modifiers & Event.SHIFT_MASK) != 0; if((keyValue != -1) && (shiftPressed)) { keyValue = -1; UI = new UserInterface("Add Condition", this ); UI.pack(); UI.show(); Trace(" \nUser adding condition", 1000); } } return true; } // end of keyDown } // end of class ExtendedGraphCanvas