CS202 - Spring 2000

Assignment 2

Updates

Due date
Friday, 11 February 2000 at 5:00pm.

Advice

Introduction to Swing
In this assignment we are going to create a user interface for the game. User interface design is a complex, intricate issue that has undergone much study. Our user interface will be very simple. It has two goals:

Since Java was released it has developed greatly in the area of user interfaces. All standard, portable user interfaces are built on top of the Abstract Windowing Toolkit (AWT), whose classes are to be found in the java.awt package. In JDK 1.2 the AWT was considerably improved from the original release, and made much use of the new inner classes language capability.

Although, in principle, this was sufficient to build any application, people soon discovered a lack of components such as checkboxes, menus, drop-down lists, buttons and others commonly found in graphical applications. Sun answered this need by implementing Swing (now called Java Foundation Classes, or JFC for short). Swing is a set of classes that create component objects using the AWT facilities and is 100% pure Java code. Swing actually comes as part of the JDK 1.2.2.

Swing and the AWT are big and complicated. You will not be able to learn them and do the assignment in the last moments. Start early! Sun provides lots of examples and tutorials about the AWT and Swing (see the reference page). You are expected to use these resources to discover the classes you need, what they can do, and how they are to be used. Some examples will be discussed in class to get you started.

User interface
Piece and WildcardPiece have been defined. The versions provided do all that was requested in A1 and more. Read the source code and comments to understand the added functionality pertaining to Piece images. You will need to use these images in the user interface. Do not concern yourself with how these images are created, and just use the appropriate accessor functions to retrieve them. You must have the IMAGES.bin file in the same directory as the .class files for this to work, since the images are stored in this file as a compressed object stream and are loaded the first time the Piece class is referenced.

Also provided, are simplified versions of the Board and BoardView classes that will appear in the final game. The final version will allow us to find vertical and horizontal words crossing a given square, evaluate the score of a play, etc... The current version just stores the Pieces on the board, and provides methods to put new pieces on, take pieces off and find out what piece is currently on a given square. The classes also statically store the specifics of a Javlle board. Read and understand these classes. 

That, in a nutshell, is your task. (This image was taken from Linux running the KDE window manager, so the outer outline of your frame and fonts may be slightly different on your system).  The program will be tested via a driver class called a2test. Your implementation should function if one types java a2test at the command line.

I have provided almost all of the code for this assignment modulo a few holes in each file which you must fill as follows with your code.

Once you have the code running a useful exercise is to look at the code and try to figure out how you think the user interface works - then test your hypothesis.

That's it. It's very basic, and Javlle needs more work. But congratulations on your very first Java user interface!

Submission
Before the assignment deadline you are expected to submit a zip file with the following code files:

Submit code files in a zip file with a text document of comments to: bww3@cornell.edu by Friday, 5:00 PM.

Make sure your program can used via the supplied driver code.

Attachments  
a2test.java Piece.java WildcardPiece.java Board.java BoardView.java IMAGES.bin
Good luck.

Last Updated: Saturday, February 05, 2000 11:44:40 PM