Java Reference
In-Depth Information
close to an existing vertex. (2) The user clicks the right-mouse button inside an
existing vertex to remove the vertex. (3) The user presses a mouse button
inside a vertex and drags to another vertex and then releases the button to cre-
ate an edge. (4) The user drags a vertex while pressing the CTRL key to move
a vertex.
**18.28
( Geometry: two circles intersect? ) The Circle2D class was defined in Program-
ming Exercise 10.11. Write an applet that enables the user to specify the location
and size of the circles and displays whether the two circles intersect, as shown in
Figure 18.32a. 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)
(c)
F IGURE 18.32
Check whether two circles, two rectangles, and two triangles are overlapping.
**18.29
( Geometry: two rectangles intersect? ) The MyRectangle2D class was
defined in Programming Exercise 10.13. Write an applet that enables the user
to specify the location and size of the rectangles and displays whether the two
rectangles intersect, as shown in Figure 18.32b. 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.
**18.30
( Geometry: two triangles intersect? ) The Triangle2D class was defined in
Programming Exercise 10.12. Write an applet that enables the user to specify
the location of the two triangles and displays whether the two triangles inter-
sect, as shown in Figure 18.32c.
*18.31
( Count-up stopwatch ) Write an applet that simulates a stopwatch, as shown
in Figure 18.33a. When the user clicks the Start button, the button's label
(a)
(b)
(c)
(d)
F IGURE 18.33
(a)-(c) The applet counts up the time. (d) The applet counts down the time.
Search WWH ::




Custom Search