Assignment #7                                      CSI205                                                Assigned:          11/19/09

                                                                                                                         Due:                 12/01/09

 

Write a class definition named GUIClock that extends JFrame and contains the following GUI controls:

6 labels (“Month”, “Day”, “Year”, “Hour”, “Minute”,”Second”), 6 ComboBoxes,  1 Botton (“Set”), and

1 uneditable TextField. You should have one Combobox for Month name (“January”, “February”,….., “December”),

one for Day numbers (0-31), one for Year Numbers (1980-2020), one for Hours (0-23), one for Minutes (0-59) and one for Seconds (0-59).

Each ComboBox should have a maximum row count of one. After the user selects values from these Comboboxes and clicks the Set button, your

application should collect the values from the Comboboxes and attempt to instantiate a Clock object from Assignment #6 with these values.

If the object instantiation is successful, you should display the return value of  Clocks toString() method in the  textfield. Otherwise, display

“Invalid Date/Time” in the textfield. You should  use the GridLayout manager to arrange your controls (8 x 2), and use additional “blank” labels

to improve the presentation of your layout.

 

You should create a client application named GUITestClock to instantiate a GUIClock object. This application should EXIT_ON_CLOSE.

 

You should submit the GUIClock.java and GUITestClock.java with the following command:

 

turnin-csi205 -c csi205 GUIClock.java GUITestClock.java

 

As usual, you should fully comment each file and each variable.

 

              

                Clock

 

                Month                       January

 

                Day                       1              

                                         

                Year                     1980

 

                Hour                     0

 

                Minute                  0

 

                Second                 0

 

                   Set

 

                January 01, 1980  00:00:00