Description
For this assignment, you’ll be making a painting program that allows the user to draw shapes on
a canvas. Please be sure to read all of the instructions before beginning.
Requirements
1. Provide line, circle, rectangle and text objects.
2. The user should be able to click and drag to draw shapes.
3. Provide a way to set different drawing colors.
4. Provide the abiltiy to draw a filled or hollow shape.
5. Handle refresh and resizing on the window.
6. Implement an abstract base class called Shape with appropriate subclasses for the
different shape objects. You should use polymorphism and dynamic binding in your
program. Think carefully about the data structure that will hold the objects.
7. In your javadocing for Paint.java (your main entry point), explain two specific
instances in your program where polymorphism is used, and one specific instance where
dynamic binding is used. Your explanation should include filenames and line numbers.
Possible Design
This is a possible design to use for your program (this is the one I used to make the screenshot
above).
1. Abstract class Shape: This is the abstract class that will be the root of the class hierarchy
for the various shapes that can be drawn. It has an abstract draw method, and protected
instance data that is common to all shapes.
2. Subclasses of Shape: These are the shapes that can be drawn on the canvas, which
implement their specific drawing behavior (how it is drawn, and how the user draws them
(ie, the user doesn’t draw a line the same way the user draws a circle)).
3. Canvas class: This holds all the Shapes, draws the shapes, and has the mouse listeners
that respond to the user drawing shapes.
4. PaintPanel class: This has the Canvas and various buttons for painting.
5. Paint class: Sets up a JFrame puts a PaintPanel in it.
Turn-in Procedure
Turn in the following files on T-Square. Double-check that you have submitted and not just
saved as draft (if the submission is successful, you will receive an e-mail from T-Square within a
few minutes). Also, be sure all of your files compile and run.
• Paint.java (the main entry point into your program)
• Shape.java (Abstract graphical object base class)
• Any other files needed to run your submission
All .java files should have a brief descriptive javadoc comment.
Don’t forget your collaboration statement. You should include a statement with every homework
you submit, even if you worked alone.

