public void buildDisplay() { if (layoutType.equals("KK")) { graphLayout = new KamadaGraphLayout(agentList, worldXSize, worldYSize, surface, updateEveryN); } else if (layoutType.equals("Fruch")) { graphLayout = new FruchGraphLayout(agentList, worldXSize, worldYSize, surface, updateEveryN); } else if (layoutType.equals("CircleLayout")) { graphLayout = new CircularGraphLayout(agentList, worldXSize, worldYSize); } // these four lines hook up the graph layouts to the stop, pause, and // exit buttons on the toolbar. When stop, pause, or exit is clicked // the graph layouts will interrupt their layout as soon as possible. Controller c = (Controller) getController(); c.addStopListener(graphLayout); c.addPauseListener(graphLayout); c.addExitListener(graphLayout); Network2DDisplay display = new Network2DDisplay(graphLayout); surface.addDisplayableProbeable(display, "JinGirNew Display"); // add the display as a Zoomable. This means we can "zoom" in on // various parts of the network. surface.addZoomable(display); surface.setBackground(java.awt.Color.white); addSimEventListener(surface); }