CS 1713 Introduction to Computer Science:
Tic Tac Toe Application - take 3


In this activity you will use a completed version of the Tic Tac Toe Application from last time to modify Case Study 15 to include a GUI.

This will be a team programming exercise.
Two or more students will work together, each creating a separate project.
At certain points you will stop and make sure your partner has gotten up to that point.
If not, you must help your partner reach that point before continuing on.

  1. Get a copy of ttt1Done.zip and load it into eclipse.
    You can find it on the Y: drive in the zips directory.
  2. Look this over and make sure you understand it.
  3. Make sure this runs and produces a frame in which you can play Tic Tac Toe.
    Stop and make sure your partners have reached this point before continuing.
  4. Get a copy of Case Study 15. You can find it on the Y: drive in the zips directory.
  5. Look it over and make sure you understand it.
  6. Make sure this runs and you can play Tic Tac Toe with it.
    The main method is in GameDriver.java.
    Stop and make sure your partners have reached this point before continuing.
  7. Rename the Case Study 15 project from cs15 to cs18 and make sure it still runs.
  8. In cs18, make a new class called UserGUI in the package tictactoe.
    This class will implement UserInterface.
    The constructor will have two parameters, a GameInterface and a boardSize and will store the parameters in attributes.
  9. Make dummy methods for the unimplemented methods.
    The easiest way to do this is the hover the mouse over the underlined UserGui and choose Add unimplemented methods.
  10. Modify GameDriver so that instead of each UserScanner it does new UserGUI(game,3);
  11. Cut and paste the contents of the main method of the completed TTTPanelTest into the contstuctor of UserGui
  12. Add a call to game.joinGame at the end of the constructor.
  13. Cut and paste the initialize method into UserGui.
    Remove the static modifier. Make attributes for board and tttPanel.
  14. Cut and paste the TicTacToePanel inner class into UserGUI.
    Remove the static modifier.
    Remove any extraneous imports that were inserted while doing the cut and paste.
  15. If you try to run the program at this point there should be only one compile error.
    Stop and make sure your partners have reached this point before continuing.
  16. Fix the one compile error.
  17. Run the program. It should bring up two frames, one for X and one for O.
    The 2 frames will be in the same place, so you will need to move one of them aside.
    Stop and make sure your partners have reached this point before continuing.
  18. Modify setId of UserGUI so that it calls setId of TicTacToePanel.
  19. In setId of UserGUI, if the parameter is 'O', move the window to position (400,0).
  20. Modify inform of UserGUI so that it calls inform of TicTacToePanel.
  21. Have boardChanged of UserGUI call the corresponding method of TicTacToePanel.
  22. You should not have a working program.
    Stop and make sure your partners have reached this point before continuing.
  23. Modify the program to fix the messages on the bottom label.