Пример #1
0
 // 140509 TA
 public void goToNextGamePanel() {
   this.getCardLayout().show(this.getcontentPane(), "Main");
   this.getCurrentPanel().hide();
   currentPanel = gamePanel.getNextPanel();
   nbrButtons = gamePanel.nbrGamesOnPanel(gamePanel.getCurrentPanelId());
   this.currentPanel.show();
 }
Пример #2
0
 // 140509 TA
 public void goToPreviousGamePanel() {
   this.getCardLayout().show(this.getcontentPane(), "Main");
   this.getCurrentPanel().hide();
   currentPanel = gamePanel.getPreviousPanel();
   nbrButtons = gamePanel.nbrGamesOnPanel(gamePanel.getCurrentPanelId());
   System.out.println(nbrButtons + " " + gamePanel.getCurrentPanelId());
   this.currentPanel.show();
 }
Пример #3
0
 // 140509 TA
 public String gameButtonPressed(int selectedButton) {
   String[] list = gamePanel.getListOfGames();
   String file = "";
   // Calculate which button was actually pressed, based on which panel is
   // shown and which button (0-x) is selected.
   int gameNumber =
       gamePanel.getCurrentPanelId() * gamePanel.getNbrGamesPerPage() + selectedButton;
   file = list[gameNumber];
   return file;
 }
Пример #4
0
  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());
  }
Пример #5
0
  /** 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();
  }
Пример #6
0
 // 140509 TA
 public void setCurrentPanel(String panelName) {
   if (panelName.equals("Main")) currentPanel = mainMenu;
   else if (panelName.equals("Games")) currentPanel = gamePanel.getPanel(0);
   else if (panelName.equals("Options")) currentPanel = optionsMenu;
   else if (panelName.equals("About")) currentPanel = aboutMenu;
 }
Пример #7
0
 /**
  * Returns the 1st game panel
  *
  * @return game menu panel
  */
 public JPanel getGamePanel() {
   return gamePanel.getPanel(0);
 }