Package view

Class GamePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GamePanel extends JPanel
The GamePanel class is responsible for rendering the game and handling input events. It extends the JPanel class and sets up the game panel with the necessary input listeners.
See Also:
  • Constructor Details

    • GamePanel

      public GamePanel(GameController gameController)
      Constructs a GamePanel with the specified GameController. Sets the background color and panel size, and adds input listeners.
      Parameters:
      gameController - the GameController to be used by this panel
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
      Paints the component by synchronizing the graphics state and rendering the game.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - the Graphics object to protect
    • getGameController

      public GameController getGameController()
      Returns the GameController associated with this panel.
      Returns:
      the GameController