Due by 2:59 pm on Friday, December 5
This lab is all about working with GUI design, using Java's Swing toolkit. There is almost no problem-solving of any kind, other than re-doing the layout of an existing GUI class.
This lab emphasizes learning through exploration. Consequently, you're being thrown in the water without swimming lessons. Fear not! It's pretty shallow water, and you'll pick it up quickly.
Files You Need
Save the following two files in a folder named "lab10":
In addition, you'll need the playingcards classes, which were introduced in Project #7. Here they are again. Both Deck.java and Hand<.java are identical to the Project & distribution. Card.java is almost identical, but two new methods were added to help with layout. As before, you'll need to save these in a folder named playingcards. Make this a sub-folder of lab10.
- Card.java: almost the code for HW#7, but with two new methods added, rankName() and suitName()
- Deck.java: identical to the code given for Project #7
- Hand.java: identical to the code given for Project #7
Files You'll Modify
All of your work will be in HighLowGUI.java. Everything else works as is, and should be left unmodified.
You are to modify the source code of the HighLowGUI class (and perhaps nested classes) to give a different layout for a High/Low card game. This is basically the example given in Eck, Chapter 6.6 (link), but I have refactored the GUI into a separate file from the one containing the main() method, and I've removed all of the event-handling code (since we' haven't learned any of that).
This version of the game is just the interface! It doesn't actually do anything. You are only working on layout here.
Make the following changes to the interface:
- There is a "prompt" message which reads "Is the next card higher or lower?" Change this message so that it displays as "The next card: more or less?"
- Change the text on the "higher" and "lower" buttons so that they display "More" and "Less", respectively. Change the text of the "New Game" button so that it displays "New".
- Change the green background to another color, of your choosing (so long as it isn't green).
- Move the buttons to another location in the window, anywhere of your choosing
Your code must be syntactically and semantically correct, which means that it has to compile successfully. Any program that cannot be successfully compiled with javac will receive no credit.
Naturally, your code must also be behaviorally correct, which means that it should print the right output in the right format. However, partial credit will be given for partial solutions. At a minimum, be sure to test on the sample input, above
A printed copy of your HighLowGUI.java file.
An electronic copy of your work should be copied to your class turn-in folder, inside of a folder named lab10.
John H. E. Lasseter