CS 261 Lab B - Card Flipper

Due Wed Jan 29 at 9:00am

Overview

In this lab you will complete a simple application that displays a graphical deck of cards, and allows the user to select and "flip" over particular cards. This toy application will give you a chance to review working with Graphical User Interfaces (GUIs), event-driving programs, and graphical drawing. It will also provide the start of a helpful interface we can use later in the semester.

This lab will be completed in pairs. Remember to review the pair programming guidelines before you get started!

Objectives

Necessary Files

You will need to download the copy of the zipped source files. and import them into Eclipse (see previous lab for instructions). These files contain a Card class to use as the basis for a playing card, part of the public interface for a DrawableCard class, and a DrawableDeck class to organize all the cards, and a basic CardFrame class to display the deck.

Note that this zipped folder also contains an "assets" folder that contains an image file you will need; you should move this asset folder into your Eclipse project; you can drag it into the file structure, drag into Eclipse, or import it as a folder.

Details

There are a number of components you need to implement in order to complete this application. Complete and test one piece at a time, and be sure to switch drivers after each step!

DrawableCard

You will need to complete the implementation of the DrawableCard class.

The CardFrame

You will also need to complete the the graphical window (CardFrame, which extends JFrame) to display your drawn deck and controls for it. Once you have your cards' drawing method implemented, your deck should show up in this frame. However, you will need to refactor some parts of this class in order to add user controls to the deck.

The Selecting Slider

In order to allow the user to select a card to flip, you'll use a GUI component you may not have seen before: the JSlider (see also 'How to use Sliders' for a tutorial and examples). You will need to look at the JavaDoc for this class in order to determine how to use it!

Figuring out the slider will involve reading the documentation; being able to browse and understand JavaDoc is an important skill to practice!

Testing and Debugging

Extensions

If you finish early, you might consider adding the following as practice:

Submission

Make sure both your names are on all the classes you've modified (DrawableCard and CardFrame), and upload the entire project directory to the LabB submission folder on hedwig (see the previous lab if you need help). Only one partner needs to upload the code. Make sure you upload your work to the correct folder! The lab is due at the start of class the morning after lab.

After you have submitted your solution, log onto Moodle and submit the Lab B Partner Evaluation. Both partners need to submit evaluations.

Grading

This assignment will be graded on approximately the following criteria: