HOMEWORK 1: Getting Acquainted with Java Swing

This is an INDIVIDUAL assignment.


In this homework assignment, we want you to become familiar with the basics of using Java Swing to create a GUI interface. Unlike in future assignments, where you'll be extending Swing to do new things, here you'll only be assembling already-provided Swing components to create a user interface.

Future assignments will build on this first assignment, so it's important for you to get this one right and to understand what you have done.


During the course of this semester, we will be creating an interactive "photo album" application. When completed, the application will allow you to view photos, annotate them, and organize them in a variety of ways.

In this homework, we'll create the basic "shell" of the application. The goal of this homework is to simply give you some practice writing basic Swing GUIs (using existing components instead of creating your own), and to make sure that your environment is set up correctly.

Your application must create a new window (a JFrame component) when it starts. The components and behaviors that your application must provide in this window are:

Your application must behave reasonably when resized, moved, etc.

For all of the controls, selecting them should display a message in the status label describing what control was just activated.

This should not be a hard assignment. Again, the main goal is to ensure that you understand how to structure a basic Swing application, how to write callbacks, and how to respond to events such as windows appearing and disappearing (to change menu labels, for instance).


This is an INDIVIDUAL assignment; while you may ask others for help on Java or Swing details, pleaes build your application on your own. While you can use any development environment you choose, you are not allowed to use "GUI builder" type tools (like JBuilder or Eclipse GUI Builder).

Here are the details for how to turn in the assignment. We'll be following this structure for all of the turn-ins:

0. Make sure your program is runnable from the command line using the command "java PhotoAlbum". Use exactly this name (with no package) to make things easier on me and the TAs.

1. Create a new directory using your last name as the name of the directory.

2. Compile your application and place both the sources and classfiles into this directory (they can be at the top-level or in a subdirectory, whatever you want).

3. Put a README.txt file (described below) into the top level of the directory. This file should contain your name and email address, the version of Java you used (1.5.x or 1.6.x, please) as well as any special info I might need in order to run your code (command line arguments, etc.)

4. ZIP this directory and submit it via T-Square (instructions are here).

Please take care to remove any platform dependencies, such as hardcoded Windows path names or dependence on a particular look-and-feel that may not exist on all platforms. Also, if you use any images in your application, please make sure that you include these in your ZIP file and that your code will refer to them and load them properly when from from inside the directory that's created when I unZIP your code.

Grading for this assignment, and future assignments, will roughly follow this breakdown:

Please let the TA or me know if you have any questions.