Swing Lab
First
First demo your applets from last week for the TA. There will be a overhead projector
in the classroom and students will load their programs on a thumbdrive and move them to the projector
computer for a beauty show.
Next
After the show you will start on your lab that will be due next week.
It will be a Tic Tac Toe game for two players. You will use Swing frames and panels to
replicate a Tic Tac Toe game. Do not make an Applet, make a stand alone application.
I used a JFrame, JPanel and a mouselistener for my example program. It took me about an hour which means it will probably
take you at least 3 hours on average.
The program should do the following things:
- Print out a blank board
- Print an X or an O in the square that the player chooses.
- Repaint just fine if the screen is covered up and uncovered.
- Let the players know when a player has won.
You can use a mouselistener or buttons to control the play. Graphics drawing or images
for the X's and O's.
Due:
During the next lab you will display the program for your TA and they will grade it during lab class.
Meaning you need to show up to lab class to get the grade, that way the lab grades can be finished by the end of the day.
Example
Click here for my example program.
(I didn't thoroughly test it so there's probably bugs, you should test yours).
You might need to resize the Frame that pops up, I wrote it as a stand alone application like you are supposed to do, but then I
put an Applet wrapper around it so it would open in a browser, but still look like a JFrame. It doesn't work well doing it that way, so the size
of the JFrame isn't what I tell it to be. After you win if you drag the window a little bigger it will say who won.