public void addGamePanels() { gamePanel = new GameSelectionPanels(resWidth, resHeight); for (int i = 0; i < gamePanel.getNumberOfPanels(); i++) { // Adds the // game // panels to // the // content // pane. contentPane.add(gamePanel.getPanel(i), "p1"); } this.controller.updateButtons(gamePanel.buttons()); }
/** Constructor for the GUI */ public GUI_Pi(Controller controller) { this.controller = controller; KeyDetector key = new KeyDetector(this, controller); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); resWidth = screenSize.width; resHeight = screenSize.height; initGui(); mainMenu.setName("Main"); // gamesMenu panels are initiated and given their name in a separate // class optionsMenu.setName("Options"); aboutMenu.setName("About"); this.controller.updateButtons(Main_Menu_Buttons); this.controller.updateButtons(gamePanel.buttons()); this.contentPane.revalidate(); this.contentPane.repaint(); }