Brief Description

In this project you are going to use Java's Swing classes to build a simple GUI for encoding messages using a Caesar cipher. Your program should do all input and output using Swing components. There should be a text box for the user to enter a message, a separate text box where the user sees the encoded message, and a third box where the user can enter a shift to determine how to encode the message. In my example I use a menu (JMenu) where the user can choose the shift.

Requirements

  1. Your program should be in a project named HW4 with a main class named Main.
  2. Use a JTextArea for the input and output areas. The output area should not be editable.
  3. The Caesar encryption should allow the user to type any combination of upper and lower case characters and a space (don't worry about other punctuation). Spaces get converted back to spaces but all other characters are shifted an amount specified by the user. All uppercase characters in the input should get converted to lower case. For example both the message "AttACK AT dawN" and "attack at dawn" get encrypted to the same thing.
  4. Lines should wrap in the input text area if they get too long. Do a little digging to figure this out. Its easy. Just look at the methods available on a JTextArea. Same thing for setting the background of the text areas to different colors.
  5. You should use a JMenu to present the user with a list of Caesar shift options.
  6. The input area should have an initial message saying Enter a message to encode. When the user clicks in the area the message should disappear. Subsequent clicks in the area should leave the message in the input area untouched.
  7. The GUI should have a sensible layout.
  8. You can run my version in the folder HW4.
  9. The program is due by Friday, November 20 by 5:00 (before you leave for Thanksgiving break).