|
EC Assignment 99
Task
Create a GUI application and/or applet using either AWT or Swing for your card game.
(This assignment is optional/extra credit).)
Textbook: the second half of every chapter
New concepts: GUIs, Swing, applets
Card Game
First of all, you may improve your card game. If you're sticking with Blackjack (from A18), you could make the following improvements:
- +0.5 - Blackjack betting
- Player starts with a bankroll and can bet a variable amount on each hand. Cannot run into debt (negative numbers).
- +0.5 - Blackjack betting-related options
- Rather than just hit or stand, the player can also split, double-down, etc.
Alternatively, you could create an entirely different card game. The game must be an existing game (not one you made up) and allow for significant user choice (so no War or similar games).
- up to +3 - Different card game
- The amount award is based on the complexity of the game: Old Maid and Go Fish are about a +1; poker is a +3.
However, while you can customize your card game, the main point of this assignment is to build a GUI for it.
GUI
To learn to make a Java GUI, find a good book or tutorial. I recommend starting with the Java Tutorial, particularly the Swing Tutorial
If you have questions regarding these specifications or how this assignment is graded, please let me know. I will spend one lab session this week discussing JOptionPanes and the very basics of creating a GUI or applet. However, outside of this single GUI lab session, I will not answer any Swing or applet questions--the point of this EC assignment is that you learn how to do it on your own.
The amount of EC you earn will depend on the sophistication of your GUI. The following are some guidelines/ideas. Your submission must work to get credit! This means you need to include all files needed to run it, including any .html files for applets, etc.
- 2 points - JOptionPanes
- An application that does not use the console at all but uses JOptionPanes for all input and output.
- 5 points - GUI Application (Text-based)
- Runs much like a text-based game, only it is displayed directly within its own JFrame window or applet panel (using a non-editable TextArea for output and a text field for input, perhaps?)
- 6 points - GUI Application (Static display with pop-ups)
- Part of the game (such as the player's hand) is displayed continuously in its own component (rather than appearing along with a printed menu). The game can be affected through components (buttons, input fields, etc) in the same panel. These components may produce pop-up/JOptionPanes to get input.
- 7 points - Applet or GUI Application (Embedded/direct controls)
- As for "Static display of pop-ups" description, but no pop-ups are used to get input. Instead, all input is done through the same panel as contains the list display.
- +0.5 points - Close button works
- Your application's X close button works.
- +0.5 points - Quit Menu
- The application window includes a simple working menu of the File -> Quit variety.
- +1.5 points - Applet
- If you do any of the above as an applet (instead of application).
- +0.5 point - Applet or Application option
- The same main class will run either as an application (by running its
main method) or can be embedded in a webpage as an applet (because it extends Applet ). (Cumulative with the +1.5 for making an applet.)
- +2 points - Link to working online version of Applet
- You get your applet version uploaded and running on your uhunix website.
- +1 points - Console mode
- It is also possible to run the game in text mode in the console window. (A command line argument will probably be required to indicate which mode to run in.)
Here is the code I showed you on GUIs in lab:
Packages and JAR files
Whatever you did for your game above, you can try using packages and a JAR file to bundle them.
- +1 - Packages
- First, put each of your finished classes in its own file. Then place all those classes in a package. You can use your
username as the package name. (This will require you to create the appropriate directory and add the package directive to all your files.) You can have additional subpackages if you desire. Recompile everything. (If you don't do the JAR file, then zip up your directory structure to submit it.)
- +1 - JAR File
- Then, produce a JAR file containing all your .class and .java files.
- +1 - Main-Class
- You should adjust the JAR file manifest so that your application runs correctly when you execute the JAR file.
To learn more about packages and deployment using JAR files, see the Java Tutorial.
Since Tamarin won't currently accept JAR files, you'll have to email this one to me. Name your file UsernameA99.jar and email it to me following the normal email submission policies.
What to Submit
Upload your UsernameA99.java file to Tamarin (unless you created the JAR file, in which case email it to me).
FAQs
|