This document provides instructions for implementing a Java 2D drawing application with various drawing tools and options. The application will allow the user to select a shape to draw, choose whether it is filled or uses a gradient, set stroke properties, and draw shapes on a panel while seeing mouse coordinates. It will also include buttons to undo, clear drawings, and select colors for gradients or solid fills.
Solid Modeling Assignment EGR 201-100 Spring 2018 .docx
Programming Assignment 5 2D Drawing Application
1. Java 2D Drawing Application. Implement the application 13.31 on pages 594 and 595 in the textbook as
illustrated in Fig. 13.34 on page 595. The application will contain the following elements:
a) an Undo button to undo the last shape drawn.
b) a Clear button to clear all shapes from the drawing.
c) a combo box for selecting the shape to draw, a line, oval, or rectangle.
d) a checkbox which specifies if the shape should be filled or unfilled.
e) a checkbox to specify whether to paint using a gradient.
f) two JButtons that each show a JColorChooser dialog to allow the user to choose the first and second
color in the gradient.
g) a text field for entering the Stroke width.
h) a text field for entering the Stroke dash length.
I) a checkbox for specifying whether to draw a dashed or solid line.
j) a JPanel on which the shapes are drawn.
k) a status bar JLabel at the bottom of the frame that displays the current location of the mouse on the
draw panel.
If the user selects to draw with a gradient, set the Paint on the shape to be a gradient of the two colors
chosen by the user. If the user does not chose to draw with a gradient, then Paint with a solid color of
the 1st Color.
Note: When dragging the mouse to create a new shape, the shape should be drawn as the mouse is
dragged.
Information on how to program this application can be found in the following sections of the textbook:
Exercises 10.1 and 10.2 in section 10.11 on pages 434 and 435, Exercise 12.17 on pages 552-553, and
Exercise 13.31 on pages 594-595. I would advise reviewing those sections before beginning this
assignment.
Note: Do not use the NetBeans GUI generator for this assignment.