CS230 Data Structures, Wellesley College, Fall 2008

Lab 8: Working with GUIs

Creating a GUI using Java Swing

Some useful links about GUI Layout Managers:
To start, download the files in the directory download/GUILab, into your local working directory.

Get their input, give them your feedback

JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something. Read the on-line tutorial for more on it. Use the following static methods in the JOptionPane to create a dialog with the user, as follows: If you need a starting point, look at the EvenOdd.java file, which contains some starting code.

TicTacToe Game

Run the class TicTacToeGUISample in the GUILab/RunSample, and play the game, to see how the program is working. Your goal is to write a JAVA class to reproduce this GUI (or a better one!). The functionality of the game is implemented in a separate file, named TicTacToe.java. Please study this file carefully, to become familiar with it to the point that you are able to build a communication between this file and the one that will contain the GUI, i.e the one you are writing.

We will define two .java files:

The file TicTacToeGUI.java is given to you. You only need to add a couple of lines of code there. A starting version of the TicTacToePanel.java is given as well. You need to add you GUI code to it, as well as the mechanism to make it responsive to the user's actions.

Some useful things to keep in mind when coding TicTacToePanel.java: