Homework 9

In homework 8, you wrote an application that generates the graphical user interface shown here:

Default Layout

In this assignment, you will add the code that allows the user to interact with the interface. In particular, when the user taps the Enter key in the radius textbox or clicks the OK button, the application will display the diameter, the circumference, and the area of the circle whose radius has been entered in the radius text box. When the user clicks the Exit button, the application will terminate. You may assume that the user enters a valid radius in the radius text box. The calculated values should all be displayed to three decimal places as shown in the sample run here:

With FlowLayout

Use a Circle object to store the radius entered by the user and to return the corresponding diameter, circumference, and area.

Bonus Points

I'll give you 5 bonus points if you create the graphical user interface using a GridBagLayout rather than a FlowLayout. Your interface should look like this:

With GridBagLayout

Submitting Your Work

Send your Hmwk09.java and Circle.java files as attachments to an email message whose subject is "Hmwk09".