CS& 141 Project 4: "Calendar Date-Finder GUI" Name: You have already created a DateAD program for the command-line. You will now get to use that class to write a GUI that creates and uses a calendar to pick a date. In order to do this, you will need to use DateAD from the previous project, create a BasicCalendar class that utilizes DateAD, and create a JFrame to utilize the BasicCalendar. The classes you create should contain at least the following:
• BasicCalendar: contains information about one month properties: • public static finals (constants) for o number of ROWS in calendarArray (6) o number of COLUMNS in calendarArray (7) • private DateAD aDay -- used to hold the month and year. The dayOfMonth should always be set to 1 so that you will always know the dayOfWeek on which the month starts . • private int[][] calendarArray -- a 6x7 array (empty spots contain 0) methods: • 3 constructors -- one default, and ones with 1 (month) and 2 (month, year) parameters. Any missing parameter or out-of-range parameter will be replaced with the current value from the system. Should call setArray(). • private void setArray -- should properly fill in the array with the current calendar. • public int at -- accessor for one element (day) of the array, at(row, column) should return the value at calendarArray[row][column], or 0 if out-of-bounds. • public String toString -- returns the month, year and calendar (as text) on multiple lines (see sample below); overrides Object.toString() • CalendarFrame: JFrame class Create a Graphical User Interface that contains all of the same elements as the one shown below. You may use "Mattisse" in Netbeans, or you may build it from scratch. The GUI needs to contain elements of the types: • JLabel • JTextField • JComboBox • JTextArea Set the possible months in the "months" combo box; Set the possible years (twelve years, starting with the current year--use a loop) in the "years" combo box. Add the following properties: • private BasicCalendar cal • private short month • private short year • private short day • private DateAD date Set the font in the textArea to a fixed-width font, such as "Courier New" In the constructor, set the values of all the appropriate fields and properties to today's date's values. Set the title to "Calendar by
A working model of this program is available on Canvas . You can run the program by unzipping all and then either typing (at the command prompt): java -jar
Physical: The Project should be turned in inside a clear plastic file folder. This folder should have a simple flap to hold paper in place--NO buttons, strings, Velcro, etc. Pages should be in order, not stapled. • Assignment Sheet (printed pdf from the web), with your name on it, as a cover sheet. • Printed Source Code with Comments (you do not need to print out DateAD.java) (including heading blocks -- a file header for each file plus a function header for each function. Describe parameters, any input or output, etc., no line wrapping). Print in portrait mode, 10 - 12 point font. Electronic: • All .class, .jar, .html (javadocs), and .java files. • Sample Output (as .rtf -- run the program, copy the window using