Java Reference
In-Depth Information
*16.7
( Set clock time ) Write a program that displays a clock and sets the time with the
input from three text fields, as shown in Figure 16.38b. Use the ClockPane in
Listing 14.21. Resize the clock to the center of the pane.
**16.8
( Geometry: two circles intersect? ) Write a program that enables the user to
specify the location and size of the circles and displays whether the two circles
intersect, as shown in Figure 16.39a. Enable the user to point the mouse inside a
circle and drag it. As the circle is being dragged, the circle's center coordinates
in the text fields are updated.
(a)
(b)
F IGURE 16.39
Check whether two circles and two rectangles are overlapping.
**16.9 ( Geometry: two rectangles intersect? ) Write a program that enables the user to
specify the location and size of the rectangles and displays whether the two rec-
tangles intersect, as shown in Figure 16.39b. Enable the user to point the mouse
inside a rectangle and drag it. As the rectangle is being dragged, the rectangle's
center coordinates in the text fields are updated.
Sections 16.6-16.8
**16.10
( Text viewer ) Write a program that displays a text file in a text area, as shown
in Figure 16.40a. The user enters a file name in a text field and clicks the View
button; the file is then displayed in a text area.
(a)
(b)
F IGURE 16.40
(a) The program displays the text from a file in a text area. (b) The program
displays a histogram that shows the occurrences of each letter in the file.
 
Search WWH ::




Custom Search