示例#1
0
  public void setup() {
    // System.out.printf( "==> GUIModel setup() called...\n" );

    super.setup(); // the super class does conceptual-model setup

    // NOTE: you may want to set these next two to 'true'
    // if you are on a windows machine.  that would tell repast
    // to by default send System.out and .err output to
    // a special repast output window.
    AbstractGUIController.CONSOLE_ERR = false;
    AbstractGUIController.CONSOLE_OUT = false;
    AbstractGUIController.UPDATE_PROBES = true;

    if (dsurf != null) dsurf.dispose();
    if (graph != null) graph.dispose();
    if (graphNbors != null) graphNbors.dispose();
    if (graphFood != null) graphFood.dispose();
    graph = null;
    dsurf = null;
    graphNbors = null;
    graphFood = null;

    // tell the Ant class we are in GUI mode.
    Ant.setupBugDrawing(this);
    Food.setupFoodDrawing(this);

    // init, setup and turn on the modelMinipulator stuff (in custom actions)
    modelManipulator.init();
    // one custom action to just print the bug list
    modelManipulator.addButton(
        "Print Bugs",
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            System.out.printf("printBugs...\n");

            printBugs();
          }
        });
    // another action:  reset all bugs probRandMove field
    // using the parameters that define the distribution to use
    modelManipulator.addButton(
        "Reset Bug probRandMove",
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            resetBugProbRandMove();
          }
        });

    if (rDebug > 0) System.out.printf("<== GUIModel setup() done.\n");
  }
示例#2
0
  public void setup() {
    Random.createUniform();
    if (surface != null) surface.dispose();
    if (degreeDist != null) degreeDist.dispose();
    if (graph != null) graph.dispose();

    surface = null;
    schedule = null;
    degreeDist = null;
    graph = null;

    System.gc();

    surface = new DisplaySurface(this, "JinGirModelII Display");
    registerDisplaySurface("Main Display", surface);
    schedule = new Schedule();
    agentList = new ArrayList();
    worldXSize = 500;
    worldYSize = 500;
  }