Create a class, Time.java, with the following GUI controls:

 

- 3 drop-down lists.

 list 1 will contain month names (January - December)

 list 2 will contain day numbers (1 -31)

 list 3 will contain year numbers (1900-2100)

 

- 3 labels ("Month", "Day", "Year") that will be placed before the

corresponding drop-down list

 

- 1 noneditable text field

 

- 5 buttons titled "Set Date", "Increase Day", "Decrease Day", "Increase

Second", "Decrease Second"

 

This classes no argument constructor will create a DateAndTime object from

assignment #5 and the GUI controls listed above. Additionally, it will have

button handlers for each button:

 

- If the Set Date button is clicked, you should read the selections from the

month, day and year drop down lists and pass their values as parameters

to DateAndTime's setDate method. If the parameters are valid and setDate returns

true you should display the result of DateAndTime's toString() method in the

text field. Otherwise, you should display the message "Invalid Date" in the

text field.

 

- If the Increase Day or Decrease Day buttons are clicked, you should call

DateAndTime's increaseDay() or decreaseDay() methods and display the result of

DateAndTime's toString() method in the text field.

 

- If the Increase Second or Decrease Second buttons are clicked, you should

call DateAndTime's increaseSecond() or decreaseSecond() methods and display the

result of DateAndTime's toString() method in the text field.

 

 

Use the flow layout manager to arrange your controls. Each drop-down list and

its corresponding label should be on a separate line, the text field on a

separate line, and the buttons arranged at the bottom in one or two rows.

 

As usual, include general comments, comment each variable and method, and

format your code neatly. You should not make any changes to the TimeType or

DateAndTime classes from assignments 4 and 5.

 Create your own (small) test client to test Time.java (and it's supporting

classes).

 

 

    • 10 years ago
    java work A+ Tutorial use as Guide
    NOT RATED

    Purchase the answer to view it

    • java_work_1.txt
    • java_work_2.txt