Introduction to Programming (CPSC 124)
—Hobart & William Smith Colleges, Fall 2014
Thursday Lab #10: GUI design
Home | Syllabus | Calendar | Class Notes | Labs and Projects | General Notes

Due by 2:59 pm on Friday, December 5

Overview

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.

Files You'll Modify

All of your work will be in HighLowGUI.java. Everything else works as is, and should be left unmodified.

Your Job

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:

  1. 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?"
  2. 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".
  3. Change the green background to another color, of your choosing (so long as it isn't green).
  4. Move the buttons to another location in the window, anywhere of your choosing

Standards

General


Turn In


John H. E. Lasseter