Class SetupController

java.lang.Object
cpsc2150.extendedConnectX.controllers.SetupController

public class SetupController extends Object
This class is the controller for our setup screen. The processButtonClick method is called by SetupView when someone clicks on the submit button. It is passed in the rows, cols, players and the number to win by the view, but it still needs to validate that input. If there are any errors it can use the displayError method in the SetupView class to inform the player of the error, then wait for them to fix it and resubmit.

If there are no errors it will create a new IGameBoard object (the implementation will depend on the size of the game board) to serve as the model, and the ConnectXController and ConnectXView. Control is then passed over the event dispatch thread that will wait for an event to occur

No changes need to be made to this class.

  • Constructor Details

    • SetupController

      public SetupController(SetupView v)

      This creates a new setup controller.

      Parameters:
      v - The setup view associated with this controller.
  • Method Details

    • processButtonClick

      public void processButtonClick(int rows, int cols, int players, int numWin)

      This processes the submit button click.

      Parameters:
      rows - Number of rows for the board
      cols - Number of columns for the board
      players - Number of players for this game
      numWin - Number of tokens in a row required to win