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
EvenOdd.java file, which contains
some starting code.
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:
TicTacToePanel.java to the set the Panel with the game's GUI, and
TicTacToeGUI.java that only contains a main() method, to set up the frame
and add the game panel to it.
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:
TicTacToePanel.java initial version, that is given to you, you will
find the definition of the createImageIcon() method. You can use this method to
create an ImageIcon instance, out of a graphics file (jpg, or gif). Then you can
add the ImageIcon to a label. (Check the
on-line Java documentation
for the available JLabel() constructors.