public Activity activateIn(Swarm context) { super.activateIn(context); // Now activate our schedule in ourselves. // This arranges for the excution of the schedule we built. displaySchedules.activateIn(this); // Activate returns the swarm activity return getActivity(); }
public Object buildObjects() { super.buildObjects(); Globals.env.createArchivedProbeDisplay(this, "observerSwarm"); getControlPanel().setStateStopped(); // First, create a colormap: this is a global resource, the information colorMap = new ColormapImpl(this); colorMap.setColor$ToName((byte) 10, "blue"); colorMap.setColor$ToName((byte) 1, "red"); colorMap.setColor$ToName((byte) 0, "white"); // Next, create a 2d window for display, set its size, zoom factor, title worldRaster = new ZoomRasterImpl(this); worldRaster.setColormap(colorMap); worldRaster.setZoomFactor(4); worldRaster.setWidth$Height(worldSizeX, worldSizeY); worldRaster.setWindowTitle("Conway's world"); worldRaster.pack(); conwayWorld = new ConwayWorld(this, worldSizeX, worldSizeY); // ConwayWorld(this) cannnot initialize DblBuffer2d correctly. conwayWorld.setSizeX$Y(worldSizeX, worldSizeY); conwayWorld.setObserver(this); try { valueDisplay = new Value2dDisplayImpl(this, worldRaster, colorMap, conwayWorld); } catch (Exception e) { System.err.println("Exception: " + e.getMessage()); System.exit(1); } try { worldRaster.setButton$Client$Message( 3, conwayWorld, new Selector(conwayWorld.getClass(), "swapColorAtX$Y", false)); } catch (Exception e) { System.err.println("Exception: " + e.getMessage()); System.exit(1); } return this; }