|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--acm.graphics.GObject | +--acm.graphics.GLine
public class GLine extends GObject implements GScalable
The GLine class is a graphical object whose appearance consists of a line segment.
Field Summary | |
double | LINE_TOLERANCE |
Constructor Summary |
GLine(double x0,
double y0,
double x1,
double y1) |
Method Summary | |
boolean | contains(double x,
double y) |
GRectangle | getBounds() |
GPoint | getEndPoint() |
GPoint | getStartPoint() |
void | scale(double sf) |
void | scale(double sx,
double sy) |
void | setEndPoint(double x,
double y) |
void | setStartPoint(double x,
double y) |
Inherited Method Summary | |
void | addMouseListener(MouseListener listener) |
void | addMouseMotionListener(MouseMotionListener listener) |
boolean | contains(GPoint pt) |
Color | getColor() |
boolean | isFilled() |
boolean | isVisible() |
void | removeMouseListener(MouseListener listener) |
void | removeMouseMotionListener(MouseMotionListener listener) |
void | sendBackward() |
void | sendForward() |
void | sendToBack() |
void | sendToFront() |
void | setColor(Color color) |
void | setFilled(boolean fill) |
void | setVisible(boolean visible) |
Field Detail |
public static final double LINE_TOLERANCE
Constructor Detail |
public GLine(double x0,
double y0,
double x1,
double y1)
Usage: | GLine gline = new GLine(x0, y0, x1, y1); | ||||||||
Parameters: |
|
Method Detail |
public boolean contains(double x,
double y)
Usage: | if (gline.contains(x, y)) . . . | ||||
Parameters: |
| ||||
Returns: | true if the point (x, y) is inside |
public GRectangle getBounds()
Usage: | GRectangle bounds = gline.getBounds(); |
Returns: | The bounding box for this object |
public GPoint getEndPoint()
Usage: | GPoint pt = gline.getEndPoint(); |
Returns: | The coordinates of the end point of the line |
public GPoint getStartPoint()
Usage: | GPoint pt = gline.getStartPoint(); |
Returns: | The coordinates of the origin of the line |
public final void scale(double sf)
Usage: | gobj.scale(sf); | ||
Parameter: |
| ||
Specified by: | scale in interface GScalable |
public void scale(double sx,
double sy)
Usage: | gline.scale(sx, sy); | ||||
Parameters: |
| ||||
Specified by: | scale in interface GScalable |
public void setEndPoint(double x,
double y)
Usage: | gline.setEndPoint(x, y); | ||||
Parameters: |
|
public void setStartPoint(double x,
double y)
Usage: | gline.setStartPoint(x, y); | ||||
Parameters: |
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |