Java Reference
In-Depth Information
The number of degrees traveled by the arc is specified in a counterclockwise direction by
using negative numbers.
Figure 13.7 shows where degree values are located when determining the starting degree
of an arc. The arc's starting angle ranges from 0 to 359 degrees counterclockwise. On a
circular ellipse, 0 degrees is at the 3 o'clock position, 90 degrees is at 12 o'clock, 180
degrees is at 9 o'clock, and 270 degrees is at 6 o'clock.
FIGURE 13.7
Determining the
starting degree of
an arc.
90
°
90
°
180
°
0
°
180
°
270
°
The last argument to the Arc2D.Float constructor uses one of three class variables:
Arc2D.OPEN for an unclosed arc, Arc2D.CHORD to connect the arc's endpoints with a
straight line, and Arc2D.PIE to connect the arc to the center of the ellipses like a pie
slice. Figure 13.8 shows each of these styles.
FIGURE 13.8
Arc closure styles.
Arc2D.OPEN
Arc2D.CHORD
Arc2D.PIE
NOTE
The Arc2D.OPEN closure style does not apply to filled arcs. A filled
arc that has Arc2D.OPEN as its style will be closed using the same
style as Arc2D.CHORD .
13
The following statement creates an Arc2D.Float object:
Arc2D.Float arc = new Arc2D.Float(
27F, 22F, 42F, 30F, 33F, 90F, Arc2D.PIE);
Search WWH ::




Custom Search