The Calendar Program The purpose of this lab is to give you a chance to use some of the data stream tools we have been discussing in a simple application. The assignment is to write a calendar application which allows the user to select a date, and either retrieve a previously stored calendar entry, or save a calendar entry. Your program should present a GUI interface which allows the user to specify the month, day, and year of the calendar entry. The GUI should also have a text area for displaying and editing a particular entry. It will also need two buttons, one for saving an entry, and the other for retrieving an entry. Required program elements: 1. Your user interface must allow the user to enter the month, day, and year. You can do this using text fields for input, or you can use ComboBoxes if you feel adventurous. 2. The only GUI components which create events that your program needs to handle are the save and retrieve buttons. 3. Donβt go overboard making your GUI beautiful! We are just looking for basic functionality here! 4. You must have a separate class which manages the calendar data. You will have a minimum of three classes in your application, a user interface class, the calendar manager class, and a calendar test class. The user interface class creates an instance of the calendar manager in its constructor and stores it in a member variable. 5. The calendar manager must provide methods which support saving a specific calendar entry and retrieving a specific calendar entry. The interfaces must be defined to only pass a single dayβs calendar entry across the interface. 6. The calendar manager must store calendar data into files according to month+year. That is, the calendar entries for December 2011 must all be stored in the same file. 7. The calendar manager must use ObjectInput/OutputStreams to read/write data from/to files. The calendar manager will use an array to store String objects. The position of a String in this array corresponds to the calendar entry for a specific day. 8. The save method of the calendar manager will need to determine if a file exists for the requested month and year. If so, the object from that file must be read into the calendar manager. Otherwise, the calendar manager must create an empty String array. The new entry must be saved to the appropriate dayβs location in the array. The modified array must be saved to the appropriate file. 9. The retrieve method of the calendar manager will need to determine if a file exists for the requested month and year. If not, return an error string indicating that there is Here is my GUI por
tion of the code import javax.swing.*; import java.awt.*; public class Main extends JFrame { private static final long serialVersionUID = 1L; public Main() { super.setTitle(β Choose Dateβ); Font font1 = new Font(βSansSerifβ, Font.PLAIN, 16); JTextField jtext = new JTextField(); jtext.setSize(200,100); jtext.setHorizontalAlignment(JTextField.LEFT); JPanel textPanel = new JPanel(new BorderLayout()); textPanel.add(jtext, BorderLayout.NORTH); JPanel buttonsPanel = new JPanel(new GridLayout(1,2,5,10)); JButton jSearch = new JButton(βSearchβ); jSearch.setFont(font1); jSearch.setBackground(Color.WHITE); jSearch.setForeground(Color.RED); JButton jSave = new JButton(βSaveβ); jSave.setFont(font1); jSave.setBackground(Color.WHITE); jSave.setForeground(Color.RED); buttonsPanel.add(jSearch); buttonsPanel.add(jSave); JPanel ComboBoxPanel = new JPanel(new FlowLayout()); JComboBox month = new JComboBox(new Object[] {βJanuaryβ, βFebruaryβ, βMarchβ, βAprilβ,βMayβ,βJuneβ,βJulyβ,βAugustβ,βSeptemberβ,βOctoberβ,βNovemberβ,βDecemberβ}); month.setForeground(Color.red); month.setBackground(Color.white); JComboBox day = new JComboBox(new Object[] {β1β, β2β, β3β, β4β,β5β³,β6β³,β7β³,β8β³,β9β³,β10β³,β11β³,β12β³,β13β³,β14β³,β15β³,β16β³,β17β³,β18β³,β19β³,β20β³,β21β³,β22β³,β23β³,β24β³,β25β³,β26β³,β27β³,β28β³,β29β³,β30β³,β31β³}); day.setForeground(Color.red); day.setBackground(Color.white); JComboBox year = new JComboBox(new Object[] {β1980β, β1981β,β1982β³,β1983β³, β1984β,β1984β³,β1985β³, β19 86β³,β1987β³,β1988β³,β1989β³,β1990β, β1991β,β1992β³,β1993β³,β1994β³,β1995β³,β1996β³,β1997β³,β1998β³,β1999β³,β2000β³,β2001β³,β2002β³,β2003β³ ,β2004β³,β2005β³,β2006β³,β2007β³,β2008β³,β2009β³,β2010β³,β2011β³,β2012β³,β2013β³,β2014β³}); year.setForeground(Color.red); year.setBackground(Color.white); ComboBoxPanel.add(month); ComboBoxPanel.add(day); ComboBoxPanel.add(year); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(ComboBoxPanel, BorderLayout.NORTH); mainPanel.add(textPanel, BorderLayout.CENTER); mainPanel.add(buttonsPanel, BorderLayout.SOUTH); add(mainPanel, BorderLayout.CENTER); } public static void main(String[] args) { Main frame = new Main(); frame.setSize(350, 125); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable( false ); frame.setVisible(true); } }