public void init(Controller c) { super.init(c); // Make the Display2D. We'll have it display stuff later. display = new Display2D(500, 500, this, 1); // at 400x400, we've got 4x4 per array position displayFrame = display.createFrame(); c.registerFrame(displayFrame); // register the frame so it appears in the "Display" list displayFrame.setVisible(true); // attach the portrayals from bottom to top display.attach(foodPortrayal, "Food"); display.attach(agentPortrayal, "Agents"); displayFrame.setTitle("Agents"); // specify the backdrop color -- what gets painted behind the displays display.setBackdrop(Color.yellow); // Make the Display2D. We'll have it display stuff later. display2 = new Display2D(400, 400, this, 1); // at 400x400, we've got 4x4 per array position displayFrame2 = display2.createFrame(); displayFrame2.setTitle("Statistic"); c.registerFrame(displayFrame2); // register the frame so it appears in the "Display" list displayFrame2.setVisible(false); // specify the backdrop color -- what gets painted behind the displays display2.setBackdrop(Color.GRAY); // attach the portrayals from bottom to top display2.attach(summaryPortrayal, "Summary"); }
public void init(final Controller c) { super.init(c); // make the displayer display = new Display2D(448, 560, this) { public void createConsoleMenu() {} public void quit() { super.quit(); ((SimpleController) c).doClose(); } }; display.setBackdrop(Color.black); displayFrame = display.createFrame(); displayFrame.setTitle("MASON Pac Man"); c.registerFrame(displayFrame); // register the frame so it appears in the "Display" list displayFrame.setVisible(true); // Notice the order: first the background, then the dots, then the agents, then the overlay display.attach(mazePortrayal, "Maze"); // display.attach( background, "Background"); display.attach(dotPortrayal, "Dots", 8, 8, true); display.attach(agentPortrayal, "Agents", 8, 8, true); display.attach(new Overlay(this), "Overlay"); // Some stuff to make this feel less like MASON // delete the header display.remove(display.header); // delete all listeners display.removeListeners(); // delete the scroll bars display.display.setVerticalScrollBarPolicy(display.display.VERTICAL_SCROLLBAR_NEVER); display.display.setHorizontalScrollBarPolicy(display.display.HORIZONTAL_SCROLLBAR_NEVER); // when we close the window, the application quits displayFrame.setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE); // can't resize displayFrame.setResizable(false); // add antialiasing and interpolation display.insideDisplay.setupHints(true, false, false); // the window won't be the right size now -- modify it. displayFrame.pack(); // Now we add in the listeners we want addListeners(display); }