|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.graphics.GObject acm.graphics.GArc
public class GArc
The GArc
class is a graphical object whose appearance consists
of an arc. If unfilled, the arc is simply a portion of the circumference of
an ellipse; if filled, the arc is a pie-shaped wedge connected to the center
of the figure.
Field Summary | |
---|---|
double |
ARC_TOLERANCE
|
Constructor Summary | |
---|---|
GArc(double width,
double height,
double start,
double sweep)
GArc object consisting of an elliptical arc
located at the point (0, 0). |
|
GArc(double x,
double y,
double width,
double height,
double start,
double sweep)
GArc object consisting of an elliptical arc
inscribed in a rectangle located at the point (x , y )
with the specified width and height. |
Method Summary | |
---|---|
boolean |
contains(double x,
double y)
|
GRectangle |
getBounds()
|
GPoint |
getEndPoint()
|
Color |
getFillColor()
|
GRectangle |
getFrameRectangle()
GRectangle in which this arc is inscribed. |
double |
getStartAngle()
GArc object. |
GPoint |
getStartPoint()
|
double |
getSweepAngle()
GArc object. |
boolean |
isFilled()
|
void |
scale(double sf)
sf , which applies
in both dimensions. |
void |
scale(double sx,
double sy)
sx and sy . |
void |
setFillColor(Color color)
|
void |
setFilled(boolean fill)
|
void |
setFrameRectangle(double x,
double y,
double width,
double height)
|
void |
setFrameRectangle(GRectangle bounds)
GRectangle . |
void |
setStartAngle(double start)
GArc object. |
void |
setSweepAngle(double sweep)
GArc object. |
Inherited Method Summary | |
void | addMouseListener(MouseListener listener) |
void | addMouseMotionListener(MouseMotionListener listener) |
boolean | contains(GPoint pt) |
Color | getColor() |
double | getHeight() |
GPoint | getLocation()GPoint .
|
GDimension | getSize() |
double | getWidth() |
double | getX() |
double | getY() |
boolean | isVisible() |
void | move(double dx, double dy)dx and dy .
|
void | movePolar(double r, double theta) |
void | removeMouseListener(MouseListener listener) |
void | removeMouseMotionListener(MouseMotionListener listener) |
void | sendBackward() |
void | sendForward() |
void | sendToBack() |
void | sendToFront() |
void | setColor(Color color) |
void | setLocation(GPoint pt) |
void | setLocation(double x, double y)x , y ).
|
void | setVisible(boolean visible) |
Field Detail |
---|
public static final double ARC_TOLERANCE
Constructor Detail |
---|
public GArc(double width,
double height,
double start,
double sweep)
GArc
object consisting of an elliptical arc
located at the point (0, 0). For complete descriptions of the
other parameters, see the entry for the
GArc
constructor that includes explicit x
and y
parameters.
Usage: | GArc garc = new GArc(width, height, start, sweep); | ||||||||
Parameters: |
|
public GArc(double x,
double y,
double width,
double height,
double start,
double sweep)
GArc
object consisting of an elliptical arc
inscribed in a rectangle located at the point (x
, y
)
with the specified width and height. The start
parameter indicates
the angle at which the arc begins and is measured in degrees counterclockwise
from the +x axis. Thus, a start
angle of 0 indicates an arc
that begins along the line running eastward from the center (the 3:00
oclock position), a start
angle of 135
begins along the line running northwest, and a start
angle of -90 begins along the line running south (the 6:00
oclock position). The sweep
parameter indicates
the extent of the arc and is also measured in degrees counterclockwise.
A sweep
angle of 90 defines a quarter circle extending
counterclockwise from the start
angle, and a
sweep
angle of -180 defines a semicircle extending
clockwise.
Usage: | GArc garc = new GArc(x, y, width, height, start, sweep); | ||||||||||||
Parameters: |
|
Method Detail |
---|
public boolean contains(double x,
double y)
GArc
class, containment depends on whether the arc is filled. Filled arcs are a
wedge in which containment can be defined in a natural way; unfilled arcs are
essentially lines, which means that containment is defined to mean that the
point is within ARC_TOLERANCE
pixels
of the arc.
Usage: | if (garc.contains(x, y)) . . . | ||||
Parameters: |
| ||||
Returns: | true if the point (x , y ) is inside
|
public GRectangle getBounds()
setFrameRectangle
.
To obtain the bounds used to describe the Java arc, use
getFrameRectangle
.
Usage: | GRectangle bounds = garc.getBounds(); |
Returns: | The bounding box of this object |
getBounds
in class GObject
public GPoint getEndPoint()
Usage: | GPoint pt = garc.getEndPoint(); |
Returns: | The point at which the arc ends |
public Color getFillColor()
getFillColor
returns the color of the
object.
Usage: | Color color = garc.getFillColor(); |
Returns: | The color used to display the filled region of this object |
getFillColor
in interface GFillable
public GRectangle getFrameRectangle()
GRectangle
in which this arc is inscribed.
Note that this is usually different from the bounding box returned by
getBounds
, which returns the bounding
box in which the displayed portion of the arc is contained.
Usage: | GRectangle bounds = garc.getFrameRectangle(); |
Returns: | The GRectangle in which this arc is inscribed
|
public double getStartAngle()
GArc
object.
Usage: | double start = garc.getStartAngle(); |
Returns: | The starting angle for this arc |
public GPoint getStartPoint()
Usage: | GPoint pt = garc.getStartPoint(); |
Returns: | The point at which the arc starts |
public double getSweepAngle()
GArc
object.
Usage: | double sweep = garc.getSweepAngle(); |
Returns: | The sweep angle for this arc |
public boolean isFilled()
Usage: | if (garc.isFilled()) . . . |
Returns: | The color used to display the object |
isFilled
in interface GFillable
public final void scale(double sf)
sf
, which applies
in both dimensions.
Usage: | gobj.scale(sf); | ||
Parameter: |
|
scale
in interface GScalable
public void scale(double sx,
double sy)
sx
and sy
.
Usage: | gobj.scale(sx, sy); | ||||
Parameters: |
|
scale
in interface GScalable
public void setFillColor(Color color)
Usage: | garc.setFillColor(color); | ||
Parameter: |
|
setFillColor
in interface GFillable
public void setFilled(boolean fill)
Usage: | garc.setFilled(fill); | ||
Parameter: |
|
setFilled
in interface GFillable
public void setFrameRectangle(double x,
double y,
double width,
double height)
Usage: | garc.setBounds(x, y, width, height); | ||||||||
Parameters: |
|
public final void setFrameRectangle(GRectangle bounds)
GRectangle
.
Usage: | garc.setFrameRectangle(bounds); | ||
Parameter: |
|
public void setStartAngle(double start)
GArc
object.
Usage: | garc.setStartAngle(start); | ||
Parameter: |
|
public void setSweepAngle(double sweep)
GArc
object.
Usage: | garc.setSweepAngle(sweep); | ||
Parameter: |
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |