Programming Assignment 4 - Shape Displayer
Requirements
The user interacts with the application as follows:
- Initially, the program displays three buttons on the top of the frame and a blank large area of a user-defined JPanel below the buttons. The buttons display a car, a snow man, and a composite shape of your choice, respectively. You are allowed to borrow the CarShape.java from the text book. Make sure to acknowledge that the code is from the text book. The composite shape of your choice should consist of at least 4 primitive shapes, but doesn't have to be fancy.
- When the user clicks on one of the buttons, the shape displayed on the clicked button becomes the current shape. The icon representing the current shape should outline the shape as shown below in the sample output. When a mouse is clicked on the user-defined JPanel, the current shape is drawn on the position which the mouse was pressed on.
- The current shape can be changed by clicking one of the buttons.
- The application should be reusable by any CompositeShape.
- Your design should be object-oriented including ShapeDisplayer(with main method), CarShape, SnowMan, and Your_own_shape classes. Also, it should include interface CompositeShape.java and a concrete class ShapeIcon. You may include more classes to your design.