![]() | Design and implement a Graphical User Interface (GUI) using Java Swing classes |
![]() | implement inheritance and polymorphism on classes that extend an abstract class |
![]() | implement handling of events generated by a graphical user interface |
![]() | implement exception handling in an application to react to error conditions |
![]() | implement file I/O read and write files |
In this multi-part assignment, you will create a Java application with which a user can
![]() | draw a variety of graphical shapes (lines, ellipses, and rectangles) |
![]() | provide a way of selecting colors for the created shapes |
![]() | save the drawn shapes to a file |
![]() | reload the file containing the previously saved shapes |
An example UI is shown below, but you may extend and customize this UI, provided that you receive approval from your instructor before submitting your assignment. Minimally, you must implement a menus, radio buttons, and a way to display the current mouse cursor coordinates (as shown). You may add additional graphics components (buttons, toolbars, checkboxes, etc) if you obtain approval.
In this lab (Part 1), you will implement only those aspects of the application's functionality that allow a user to:
![]() | select a shape to be drawn with via a radio button |
![]() | create a shape (in a fixed color of your choice) by moving the mouse to a starting point, pressing the mouse button, moving the mouse to an ending point, and releasing the mouse button. Every time this is done, the selected type of shape is created and added to the collection of shapes. |
![]() | erase the collection of shapes via the File/New menu item |
![]() | exit the program via the File/Exit menu item |
The application does not have to support the selection of shape colors, background color, save the drawn shapes to a file, nor load a file of previously-saved shapes. That functionality will be added in the next assignment.
In this assignment, you will add UI creation and event-handling logic to a partially-completed version of this application.
![]() | First create the Lab8 project. Download this
lab8.zip
file; then follow these steps to import it :
|
![]() | Rename the edu.msoe.se1021.drawing.YOURNAME
to match your MSOE username (see steps below).
|
The lab8.zip file includes the following classes:
![]() | DrawingProgramApp.java - A main class that is also the UI, which also contains several private inner classes: MenuHandler, RadioButtonHandler, MouseEventHandler, and DrawingPanel. |
![]() | AbstractShape.java |
You must add the following classes:
![]() | Ellipse.java |
![]() | Rectangle.java |
![]() | Line.java |
Note: Remember to comment your code. All classes and all methods must be commented using Javadoc comments.
Your grade will be based on the following criteria:
![]() | Meeting requirements; your program must compile and
run, and produce well-formed, explicit error messages. If you have trouble, you must come to see me. If you don't and you
submit a program that does not compile or produce detailed meaningful results will
receive a grade of no higher than 50, even after reworking your program. |
![]() | Technical quality of your program. Technical quality consists of formatting, commenting, and
following coding style guidelines. |
![]() | Spelling and grammar. |
![]() | Timeliness of submission as stated in the course policies. |