Problem

(Geometry: display an n-sided regular polygon) Programming Exercise 13.25 created the Re...

(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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT