Question 4
Write a GUI-based program to perform encryption and decryption using shift cipher. The following screenshots illustrate the GUI and the functionalities of the program.
Upon startup, the program displays a window as shown on the left.
There are four labels (JLabel), four text fields (JTextField) and four buttons (JButton).
The bottom two text fields are used for displaying message only. Therefore, they are not editable.
The user must indicate a shift value between 1 ~ 25. The shift value (and shift cipher) will be explained in the subsequent paragraphs.
The program will display a dialog box to inform the user if the shift value is invalid.
Note
You may assume the user will always enter an integer.
Once a valid shift value is entered and the Set button is clicked, the user may use the program to encrypt (scramble) message.
User enters a message, clicks the Encrypt button, and the program will encrypt (scramble) the message.
Note
You may assume the user will always enter valid characters: A, B, C, … Z