Java Reference
In-Depth Information
΢΢GExercise P10.13. In the application from Exercise P10.12, replace the
text area with a bar chart that shows the balance after the end of each
year.
΢΢΢GExercise P10.14. Write a program that contains a text field, a button
ȒAdd Valueȓ, and a component that draws a bar chart of the numbers
that a user typed into the text field.
΢΢GExercise P10.15. Write a program that prompts the user for an integer
and then draws as many rectangles at random positions in a component
as the user requested.
΢GExercise P10.16. Write a program that prompts the user to enter the x- and
y-positions of the center and a radius. When the user clicks a ȒDrawȓ
button, draw a circle with that center and radius in a component.
΢΢GExercise P10.17. Write a program that allows the user to specify a circle
by typing the radius in a text field and then clicking on the center. Note
that you don't need a ȒDrawȓ button.
΢΢΢GExercise P10.18. Write a program that allows the user to specify a
circle with two mouse pr esses, the first one on the center and the
second on a point on the periphery. Hint: In the mouse press handler,
you must keep track of whether you already received the center point
in a previous mouse press.
494
495
΢΢΢GExercise P10.19. Write a program that draws a clock face with a time
that the user enters in two text fields (one for the hours, one for the
minutes).
Hint: You need to determine the angles of the hour hand and the
minute hand. The angle of the minute hand is easy: The minute hand
travels 360 degrees in 60 minutes. The angle of the hour hand is
harder; it travels 360 degrees in 12¶60 minutes.
΢΢GExercise P10.20. Write a program that asks the user to enter an integer n,
and then draws an n-by-n grid.
Search WWH ::




Custom Search