Project 8: GUIs

The goal of this project is to compose your own program using Java's GUI packages. You will make use of your Caesar cipher algorithm from Lab 7

1. Introduction

In this project, you will redo what you did in the previous lab, except that instead of the user being able to shift ahead by pressing enter, the user can shift forward and backward by clicking on appropriate buttons in a window.

2. A Decoder Program

Write a program that works as follows:

For example, if the text the user enters is "My name is Vercingetorix", pressing the ">" button will change the text to "Nz obnf jt Wfsdjohfupsjy." Pressing ">" again will change the text to "Oa pcog ku Zgtekpigvqtkz." Pressing "<" will return it to "Nz obnf jt Wfsdjohfupsjy." If you restart the program and enter "Nz obnf jt Wfsdjohfupsjy" and click "<" once or click ">" 25 times, you will get the decoded message "My name is Vercingetorix."

3. Tips and Hints

Remember, the program will have two windows. The action listener for the "enter" button on the first window must do a lot of things. First, it must set the original window to no longer be visible (setVisible(false)). Then it must create the second window, add all the components, attach action listeners to the "<" and ">" buttons, etc. Think carefully about what each action listener class's instance variables need to be. What components does it need to be able to communicate with?

Although what was covered in class should be enough to complete this project, feel free to experiment with other things from the textbook and the Java API to improve the appearance of your program.

4. Testing

Use your program to decrypt the following messages sent over the front lines (these are the same as in Lab 7... sorry):

5. Turn in

Turn this project in electronically by copying your source files to a directory I have prepared for you:

cp *.java /homeemp/tvandrun/turnin/235/{your last name, lowercase}

DUE: Thurs, Apr 26, at 5:00 PM.

ALSO: No project will be accepted later than Fri, Apr 27, at 5:00 PM, even if you have two late days left.


Thomas VanDrunen
Last modified: Mon Jul 23 14:41:41 CDT 2007