I am working on this assignment:
"In this exercise, you will implement a GUI application that uses the MyShape hierarchy from Exercise 10.10 to create an interactive drawing application. You will create two classes for the GUI
and provide a test class that launches the application. The classes of the MyShape hierarchy require no additional changes.
The first class to create is a subclass of JPanel called DrawPanel, which represents the area on which the user draws the shapes. Class DrawPanel should have the following instance variables:
a) An array shapes of type MyShape that will store all the shapes the user draws.
b) An integer shapeCount that counts the number of shapes in the array.
c) An integer shapeType that determines the type of shape to draw.
d) A MyShape currentShape that represents the current shape the user is drawing.
e) A Color currentColor that represents the current drawing color.
f) A boolean filledShape that determines whether to draw a filled shape.
g) A JLabel statusLabel that represents the status bar. The status bar will display the coordinates of the current mouse position.
Class DrawPanel should also declare the following methods:
a) Overridden method paintComponent that draws the shapes in the array. Use instance
variable shapeCount to determine how many shapes to draw. Method paintComponent
should also call currentShape
0 · ·