Class GamePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class GamePanel extends GenericPanel
Panel used in the Gameplay Section.
See Also:
  • Field Details

  • Constructor Details

    • GamePanel

      public GamePanel(SwingViewImpl parent, String backgroundSource)
      Game Panel Constructor.
      Parameters:
      parent - the application's view.
      backgroundSource - the background image source.
      See Also:
  • Method Details

    • showGrid

      public void showGrid()
      Displays all grid elements by adding them to the container. This method makes all grid elements visible on the container.
    • hideGrid

      public void hideGrid()
      Hides all grid elements by removing them from the container. This method hides all grid elements by removing them from the container.
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • endGame

      public void endGame(boolean win)
      Shows the End Game Scene.
      Parameters:
      win - if player won or lost.
    • userPlantingStatus

      public void userPlantingStatus(boolean isUserPlanting)
      userIsPlanting setter.
      Parameters:
      isUserPlanting - if the user is planting or not.
    • isUserPlanting

      public boolean isUserPlanting()
      userIsPlanting getter.
      Returns:
      userIsPlanting status