public void init(Controller c) {
    super.init(c);
    // Make the Display3D.  We'll have it display stuff later.
    display = new Display3D(600, 600, this);

    // attach the portrayals to the displayer, from bottom to top
    display.attach(heatPortrayal, "Heat");
    display.attach(bugPortrayal, "Bugs");
    heatPortrayal.setValueName("Heat");

    HeatBugs hbState = (HeatBugs) state;

    // center the bug graph.  Right now it's located at the (0,0) position.  For
    // example, if it's a 5x5 graph, and the origin is at (0,0), we want to move it
    // to (2,2).  So we want it to be at (  (5-1)/2 = 2,  (5-1/2) = 2  ).  Similarly,
    // if it's a 6x6 graph we want the origin to be at (2.5, 2.5), dead center between
    // the (2,2) and (3,3) grid positions.  To center
    // the origin there, we need to move the graph in the opposite direction.
    // so the general equation for each dimension: (numGridPoints - 1) / -2.0.
    display.translate((hbState.gridWidth - 1) / -2.0, (hbState.gridHeight - 1) / -2.0, 0);

    // now let's scale it so it fits inside a 1x1x1 cube centered at the origin.  We don't
    // have to, but it'll look nicer.
    display.scale(1.0 / Math.max(hbState.gridWidth, hbState.gridHeight));

    displayFrame = display.createFrame();
    c.registerFrame(displayFrame); // register the frame so it appears in the "Display" list
    displayFrame.setVisible(true);
  }