Java Reference
In-Depth Information
**28.21
(
Display sets of connected circles
) Modify Listing 28.10,
ConnectedCircles.java, to display sets of connected circles in different colors.
That is, if two circles are connected, they are displayed using the same color;
otherwise, they are not in same color, as shown in Figure 28.25. (
Hint
: See
Programming Exercise 28.4.)
(a)
(b)
(c)
F
IGURE
28.25
(a) Connected circles are displayed in the same color. (b) Rectangles are not filled with a color if they are
not connected. (c) Rectangles are filled with a color if they are connected.
*28.22
(
Move a circle
) Modify Listing 28.10, ConnectedCircles.java, to enable the
user to drag and move a circle.
**28.23
(
Connected rectangles
) Listing 28.10, ConnectedCircles.java, allows the user
to create circles and determine whether they are connected. Rewrite the pro-
gram for rectangles. The program lets the user create a rectangle by clicking a
mouse in a blank area that is not currently covered by a rectangle. As the rec-
tangles are added, the rectangles are repainted as filled if they are connected or
are unfilled otherwise, as shown in Figure 28.25b-c.
*28.24
(
Remove a circle
) Modify Listing 28.10, ConnectedCircles.java, to enable the
user to remove a circle when the mouse is clicked inside the circle.
Search WWH ::
Custom Search