Reference no: EM131338
Task 1
Create a new project in Eclipse.
Create a package called ‘people' within this project. Download the start up classes and put them into this package. Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.
TestUniApplication.
• Create a class, called TestUniApplication, that causes a JFrame window to appear when the application first starts. The window, that appears when the program is executed, should be appropriately sized, titled and located on the screen. The class could have a private instance variable of type Vector (not ArrayList) called students.
• Provide a menu, called Students, with the subsequent menu items
o Add Student
o List Students
o Exit
• Provide the subsequent functionality when each of the menu items is selected
o Add Student - a modal dialog box, called AddStudent, should appear. The details for this dialog box appear below.
o List Students - a modal dialog box, called ListStudents, should appear. The details for this dialog box appear below.
o Exit - the application will close.
• Provide a pushbutton, called Exit, which provides the same functionality as the menu item with the same name.
Task 2
Create a third package called ‘task02'. Copy the TestUniApplication, AddStudentDialog and ListStudentDialog across to this new package. Make the subsequent modifications to TestUniApplication
• Provide a second menu called File with the following menu items.
o A menu item called save. When this item is selected, the whole Vector is stored to a file using serialisation. Use a FileChooser object for this. The starting directory for the FileChooser object should be c:\\input.
o A menu item called open. When this item is selected, a FileChooser object appears which enables the user to open a file that was previously save (using the ‘save' button). The Vector object should be read from the file, and its contents added to whatever is currently in the main Vector collection.
o A menu item called empty that will remove all Students currently in the Vector. A message box should appear to confirm with the user if this is the action they want taken.
Make the subsequent modifications to ListStudentDialog
• Add a new button (called remove) to remove the selected Student. When this button is clicked a message box should appear asking whether the user is sure that they want to delete the student. If the user selects ‘yes' the Student should be removed from the underlying Vector. The window should then close and control return to the main window.
• Note that if you click the remove button with no item selected in the list, the program will crash with an ArrayOutOfBoundsException. While there are several ways of dealing with this, the program should use a try/catch block that provides a message dialog (in the handler) telling the user that an item must be selected.