Modifier and Type | Field and Description |
---|---|
static double |
ARC_TOLERANCE
This constant defines how close (measured in pixel units) a point has
to be to an arc before that point is considered to be "contained" within
the arc.
|
Constructor and Description |
---|
GArc(double width,
double height,
double start,
double sweep)
Creates a new
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)
Creates a new
GArc object consisting of an elliptical arc
inscribed in a rectangle located at the point (x , y )
with the specified width and height. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Checks to see whether a point is inside the object.
|
GRectangle |
getBounds()
Returns the bounding box of the arc.
|
GPoint |
getEndPoint()
Returns the point at which the arc ends.
|
java.awt.Color |
getFillColor()
Returns the color used to display the filled region of this object.
|
GRectangle |
getFrameRectangle()
Returns the bounds of the
GRectangle in which this arc is inscribed. |
double |
getStartAngle()
Returns the starting angle for this
GArc object. |
GPoint |
getStartPoint()
Returns the point at which the arc starts.
|
double |
getSweepAngle()
Returns the sweep angle for this
GArc object. |
boolean |
isFilled()
Returns whether this object is filled.
|
void |
paint(java.awt.Graphics g)
Implements the
paint operation for this graphical object. |
java.lang.String |
paramString()
Returns a string indicating the parameters of this object.
|
void |
scale(double sf)
Scales the object on the screen by the scale factor
sf , which applies
in both dimensions. |
void |
scale(double sx,
double sy)
Scales the object on the screen by the scale factors
sx and sy . |
void |
setFillColor(java.awt.Color c)
Sets the color used to display the filled region of this object.
|
void |
setFilled(boolean fill)
Sets whether this object is filled.
|
void |
setFrameRectangle(double x,
double y,
double width,
double height)
Changes the arc bounds to the specified values.
|
void |
setFrameRectangle(GRectangle bounds)
Changes the arc bounds to the values from the specified
GRectangle . |
void |
setStartAngle(double start)
Sets the starting angle for this
GArc object. |
void |
setSweepAngle(double sweep)
Sets the sweep angle for this
GArc object. |
addActionListener, addMouseListener, addMouseMotionListener, contains, fireActionEvent, fireActionEvent, getColor, getHeight, getLocation, getParent, getSize, getWidth, getX, getY, isVisible, move, movePolar, pause, removeActionListener, removeMouseListener, removeMouseMotionListener, sendBackward, sendForward, sendToBack, sendToFront, setColor, setLocation, setLocation, setParent, setVisible, toString
public static final double ARC_TOLERANCE
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.width
- The width of the rectangle in which the arc is inscribedheight
- The height of the rectangle in which the arc is inscribedstart
- The angle at which the arc begins measured in degrees counterclockwise
from the +x axissweep
- The extent of the arc, measured in degrees counterclockwisepublic 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
o’clock 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
o’clock 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.x
- The x-coordinate for the rectangle in which the arc is inscribedy
- The y-coordinate for the rectangle in which the arc is inscribedwidth
- The width of the rectangle in which the arc is inscribedheight
- The height of the rectangle in which the arc is inscribedstart
- The angle at which the arc begins measured in degrees counterclockwise
from the +x axissweep
- The extent of the arc, measured in degrees counterclockwisepublic void setStartAngle(double start)
GArc
object.start
- The new starting anglepublic double getStartAngle()
GArc
object.public void setSweepAngle(double sweep)
GArc
object.sweep
- The new sweep anglepublic double getSweepAngle()
GArc
object.public GPoint getStartPoint()
public GPoint getEndPoint()
public void paint(java.awt.Graphics g)
paint
operation for this graphical object. This method
is not called directly by clients.public GRectangle getBounds()
setFrameRectangle
.
To obtain the bounds used to describe the Java arc, use
getFrameRectangle
.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.public void setFrameRectangle(double x, double y, double width, double height)
x
- The x-coordinate for the rectangle in which the arc is inscribedy
- The y-coordinate for the rectangle in which the arc is inscribedwidth
- The width of the rectangle in which the arc is inscribedheight
- The height of the rectangle in which the arc is inscribedpublic final void setFrameRectangle(GRectangle bounds)
GRectangle
.bounds
- A GRectangle
specifying the new arc boundspublic 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.GRectangle
in which this arc is inscribedpublic void scale(double sx, double sy)
sx
and sy
.public final void scale(double sf)
sf
, which applies
in both dimensions.public void setFilled(boolean fill)
public boolean isFilled()
public void setFillColor(java.awt.Color c)
setFillColor
in interface GFillable
color
- The color used to display the filled region of this objectpublic java.awt.Color getFillColor()
getFillColor
returns the color of the
object.getFillColor
in interface GFillable
public java.lang.String paramString()