(Geometry: display an n-sided regular polygon) Programming Exercise 13.25 created the RegularPolygonPanel for displaying an n-sided regular polygon. Write a program that displays a regular polygon and uses two buttons named +1 and -1 to increase or decrease the size of the polygon, as shown in Figure 16.30a–b. Also enable the user to increase or decrease the size by clicking the right or left mouse button and by pressing the UP and DOWN arrow keys.
Ref prb:
(Geometry: display an n-sided regular polygon) Define 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 in the panel. The size of the polygon is proportional to the size of the panel. Create a pentagon, hexagon, heptagon, octagon, nonagon, and decagon from RegularPolygonPanel and display them in a frame, as shown in Figure 13.33a.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.