Write an applet using methods from interfaces MouseListener
and MouseMotionListener that allows the user to press the
mouse button, drag the mouse and release the mouse button. As the user drags
the mouse, and when the mouse is released, draw a shape with the appropriate
upper-left corner, width and height. Use a separate event-listener class to
handle the mousePressed, mouseDragged, and
mouseReleased events. Hint: the mousePressed method should
capture the set of coordinates at which the user presses and holds the mouse
button initially and the mouseDragged and
mouseReleased methods should capture the set of coordinates
at which the user has dragged the mouse to or released the button. Both
methods should call methods in the applet to set appropriate coordinate
values. All calculations of the width, height, and upper-left corner should
be performed by the paint method before the shape is
drawn.
Provide a Choice button to allow the user to select which
shape to draw. The choices should include at least Rectangle, Oval,
Line, and Rounded Rectangle.
Allow the user to select the drawing color.
Allow the user to specify if a shape should be filled or empty when it
is drawn. The user should click a Checkbox to indicate
filled or empty.