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. "Reasonably" means that the window should be resizable, but that panels that the various components should have minimum sizes so that control panels cannot be shrunk in a way that clips their contents. Likewise, enlarging the window should make the content size larger but not expand control panels unnecessarily. (Look at the way that most "standard" desktop apps behave when resizing, and ask if you have any questions.)

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).


See here for instructions on how to submit your homework. These instructions will be the same for each assignment.