Team Project
Use Blackboard to submit your Eclipse project as a zip file.
Develop a Java program, JSketchPad,
that can be used to create drawings that are composed of triangles and ovals. None
of these figures are filled.
Your program MUST have the
following functionality:
- Document your code using Javadoc comments! You will receive a grade of 0 or 1 on this element. Your project grade is the product of the documentation grade and the grade you receive for the rest of the project.
- The Triangle and Oval class that you develop must extend this abstract class: Shape.java
- (20 points) A fully menu-driven user interface,
including (at a minimum) the following menu options:
- File (New, Open, Save)
- Edit (Select, Cut)
- Draw (Choose Color, Triangle,
Oval). (See section 13.7 of
your text for an example illustrating the use of a JColorChooser)
- (20 points) Allow the user to draw triangles. The desired
interaction is:
- User uses mouse clicks to mark vertices, and mouse drags to draw the sides of the triangle. An object
corresponding to the triangle is instantiated and stored in an ArrayList of Shapes.
(20 points) Allow the user to draw
ovals using the mouse. The desired interaction is:
- User presses left mouse button to indicate top left corner
of the rectangle that contains (is the bounding box for) the
oval.
- User drags mouse to draw oval. The oval being
drawn is visible during the drag
operation.
- Mouse release marks the bottom right corner of the bounding
rectangle. An object corresponding to the oval is instantiated and
stored stored in an ArrayList of Shapes.
(10 points) Minimizing the window and
restoring it, or otherwise occluding the window, should not affect the
drawing.
(20 points) Allow the user to select one of the objects in
the drawing. The desired interaction is:
- User chooses the Select menu option. Program enters selection
mode.
- User clicks on the drawing. The object that contains the click-point is selected,
and selected object turns red.
(20 points) Allow the user to
cut the currently selected
object. The object is removed from the ArrayList of Shapes.
- (20 points) Allow the user to store a textual representation of
a drawing in a text file. Here is an example of reading and writing text files. Use a JFileChooser to select a
file. (See section 13.7 of
your text for an example illustrating the use of a JFileChooser).The
text file must follow the format detailed below to describe the
objects.
- Triangles are described as: T x1 y1 x2 y2 x3 y3 redValue greenValue blueValue. The x and y correspond to the coordinates of the 3 vertices of the triangle. The last three integers encode the color of the Triangle
- Ovals are described as: O topLeftX topLeftY width height redValue greenValue blueValue.
The dimensions are those of the oval's bounding box. The last three integers encode the color of the Oval.
- (20 points) Load a stored drawing from a file and display it.
The user should then be able to edit the drawing. Use a
JFileChooser to select a file.Your program should be
able to load any drawing that uses the format detailed
above.
- (10 points) Conformance to the following coding
conventions.
- (20 points) Some novel functionality that YOU choose to implement. How many points you get depends on the utility of the feature and the slickness of the implementation.