![]() |
![]() |
![]() |
![]() |
![]() |
|
Once you have constructed a path, you specify the shape of that path using
path-defining methods. The two most commonly
used path-defining methods in the GeneralPath class are
moveTo and lineTo. The moveTo method
specifies a virtual pen move from the current position to a specified
position without leaving a track; the lineTo method specifies a
virtual pen move from the current position to a specified position with a
track.
Thus, to specify the straight lines required by the meter, you use the
following moveTo and lineTo operations, once you have
converted the int variables of Segment 1113 to
float variables.
path.moveTo(lineXOffset, lineYOffset); path.lineTo(lineXOffset + meterWidth, lineYOffset); path.moveTo(lineXOffset + pointerPosition, lineYOffset); path.lineTo(lineXOffset + pointerPosition, lineYOffset - meterHeight);