Question: In Java: Create a subclass of JPanel, named RegularPolygonPanel, to paint an n- sided regular polygon. The class contains a property named numberOfSides, which specifies
Create a subclass of JPanel, named RegularPolygonPanel, to paint an n- sided regular polygon. The class contains a property named numberOfSides, which specifies the number of sides in the polygon. The polygon is centered at the center of the panel. The size of the polygon is proportional to the size of the panel. Create a pentagon, hexagon, heptagon, and octagon, nonagon, and decagon from RegularPolygonPanel and display them in a frame, as shown in the figure below. Your Task: 1. Create a class named RegularPolygonPanel to paint an n-sided regular polygon. (So, if n is 3, it paints a triangle, if n is 4, it paints a square, etc.) 2. Create a frame classes that contains pentagon, hexagon, heptagon, and octagon, nonagon, and decagon. These objects are created from RegularPolygonPanel. 3. Draw a UML diagram for RegularPolygonPanel class and the frame class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
