CST2641 Advanced Java I
Lab Week 6


Exercises

Exercise 9.1

For this exercise you are going to build upon the program that you did for Exercise 8.1, the combination safe.

Modify your program so that both the try again and the change combination button uses a graphic, a shortcut key, and a pop up tool tip.

When entering a new combination, use a formatted input field (JFormattedTextField) such that the user can enter only three numerals 1 through 9.  No other characters should be allowed.  So the combinations allowed are "111" through "999" with never a zero.

Label your components.  (Do not use drawString.)  So the formatted input field for your new combination should be labeled with something descriptive, like "New Combination", and the the buttons for entering the numerals should be grouped and a label describes them as "Combination Entry Keys" or something similar.

Also set up a menu for the application.  You should have at least three menu selections.  File exit, another that shows your current combination, and a menu selection for help.  Create an icon for the help menu selection.  Also create keyboard accelerators for your menu selections.

When the user clicks on your "help" menu selection, pop up a modal dialog box that provides some basic help information on how to use your program.  Have an "OK" button on the bottom of this pop up dialog box that closes this box.  This should be similar to the figure 9-48 on page 463 of the text.

Use a layout system other than the default flow layout.  Create a layout that looks professional.

The program needs to be a stand alone application written using swing.

Java program example.  Copy all the files locally to your machine and run safe.class.

Exercise 9.2 (Extra Credit)

Take the program above,  turn it back into an applet, and make it run within a web page, and continue using swing.  It must be launched within a web browser (not from the run Java applet menu selection in Textpad).

Note:  It may be quite difficult to get graphics on the buttons when it is an applet.  Extra extra credit if you can use graphics in an applet that runs in a web browser.  :-)

Exercise 9.3

Take the program that you created for  Exercise 9.1 and add two additional control types to it.  These can be anything learned from chapter 9 in the textbook.  Examples would be Text Areas, Check Boxes, Radio Buttons, Combo Boxes, pop up menus, etc.  Use the controls in a fashion that would add additional functionality to your program.