In Assignments Two and Three, you created six different classes (Time, HomeActivity, SchoolActivity, OtherActivity, Activity, and DayPlanner) and were able to insert and search for relevant activities. You were also able to read/write activities from/to files and maintain a HashMap index to speed up the title search. In Assignment Four, you will add a GUI interface and exception handling so that the system will be more robust and user-friendly. There are also bonus marks for any efforts beyond the basic requirements to make your system even more useful and attractive. Please note that you are NOT ALLOWED to use NetBean GUI builder or any other GUI packages (other than awt and swing) for this assignment since we want you to learn the basic ways of building GUI interfaces for an application.

Specific Requirements

Create an initial interface that looks like the following. The content pane shows a welcome message and a brief instruction of how to use the system, and the “commands” menu has three choices: add, search, and quit. Choosing the “add” command will change the interface to the look described in requirement (2); choosing the “search” command will change to interface to the look described in requirement (3); and choosing the “quit” command will simply terminate the program. Note that choosing the X button on the window frame will also terminate your application. See image.

Create the following interface for adding an activity. When the user selects the “add” command, the initial interface will be changed to the following. The type can be selected through a combo-box with three choices: home, school, and other. The default choice is “school”, but the user can change it to another choice in the drop-down list. The other five attributes: title, starting time, ending time, location, and comment all get their values through textfields. There are two buttons on the righthand side: clicking the “reset” button will clear all the textfields and clicking the “enter” button will try to create an object for the related activity. However, if there are any violations for the validity of the activity, an error message will be displayed in the text area at the bottom of the interface and the user is required to try again. Note that the location attribute is only visible for the “other” activity type; for “home” and “school” activity types, it will be made invisiable so that the user will not be able to enter any value for location. See image.

Create an interface for searching activities. When the user selects the “search” command, the current interface will be changed to the following. The interface is almost the same as that for adding an activity, except that the drop-down list for the activity type can have an empty choice and attributes for location and comment are removed. In addition, the text area for “Messages” is now replaced by one for “Search Results”. In both cases, you will need to use scrollable text areas so that the user can see the full content if needed. See image.

Add exception handling to your program so that errors and any violations to the invariant conditions can be handled more elegantly. More specifically, you need to throw exceptions in constructors and mutator methods whenever the class invariants are violated. You should also use exception handling to check for incorrect input so that the user will be allowed to try again for correct values.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.