|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwheels.etc.AbstractGraphic
wheels.users.Shape
wheels.users.Line
Class that models a 2D line. Has methods allowing you to adjust the line's points, thickness, color, etc.
| Field Summary | |
static int |
DEFAULT_LENGTH
|
| Fields inherited from class wheels.users.Shape |
_dp, _shape, DEFAULT_COLOR |
| Constructor Summary | |
Line()
Creates a Line with default endpoints in the wheels.users.Frame's DrawingPanel. |
|
Line(DrawingPanel dp)
Creates a Line with endpoints (0, 0) and (0, 0) in the specified DrawingPanel. |
|
Line(DrawingPanel dp,
int x1,
int y1,
int x2,
int y2)
Creates a Line with the specified endpoint coordinates in the specified DrawingPanel. |
|
Line(DrawingPanel dp,
Point p1,
Point p2)
Creates a Line with the specified endpoints in the specified DrawingPanel. |
|
Line(int x1,
int y1,
int x2,
int y2)
Creates a Line with the specified coordinates in the wheels.users.Frame's DrawingPanel. |
|
Line(Point p1,
Point p2)
Creates a Line with the specified endpoints in the wheels.users.Frame's DrawingPanel. |
|
| Method Summary | |
void |
actualPaint(Graphics2D g)
Subclasses must define this to do the actual painting of the shape. |
Rectangle |
getBounds()
Returns the bounding rectangle of the line. |
Point |
getP1()
Returns the first endpoint. |
Point |
getP2()
Returns the second endpoint. |
int |
getThickness()
Returns the thickness of the stroke. |
int |
getX1()
Return the x coordinate of the first endpoint. |
int |
getX2()
Return the x coordinate of the second endpoint. |
int |
getY1()
Returns the y coordinate of the first endpoint. |
int |
getY2()
Returns the y coordinate of the second endpoint. |
void |
setP1(int x,
int y)
Sets the coordinates of the first endpoint. |
void |
setP1(Point p1)
Set the first endpoint. |
void |
setP2(int x,
int y)
Sets the coordinates of the second endpoint. |
void |
setP2(Point p2)
Set the second endpoint. |
void |
setPoints(int x1,
int y1,
int x2,
int y2)
Sets the endpoints of the Line to the specified coordinates |
void |
setPoints(Point p1,
Point p2)
Sets the endpoints of the Line to the specified values. |
void |
setThickness(int thickness)
Sets the thickness of the stroke used to paint the line. |
| Methods inherited from class wheels.users.Shape |
contains, getColor, getRotation, hide, paint, setColor, setRotation, show |
| Methods inherited from class wheels.etc.AbstractGraphic |
mouseClicked, mouseDragged, mousePressed, mouseReleased |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_LENGTH
| Constructor Detail |
public Line()
public Line(int x1,
int y1,
int x2,
int y2)
x1 - the x value of the first endpointy1 - the y value of the first endpointx2 - the x value of the second endpointy2 - the y value of the second endpoint
public Line(Point p1,
Point p2)
p1 - the first endpointp2 - the second endpointpublic Line(DrawingPanel dp)
public Line(DrawingPanel dp,
int x1,
int y1,
int x2,
int y2)
dp - the DrawingPanel in which the line will be drawnx1 - the x value of the first endpointy1 - the y value of the first endpointx2 - the x value of the second endpointy2 - the y value of the second endpoint
public Line(DrawingPanel dp,
Point p1,
Point p2)
dp - the DrawingPanel in which the line will be drawnp1 - the first endpointp2 - the second endpoint| Method Detail |
public void setPoints(int x1,
int y1,
int x2,
int y2)
public void setPoints(Point p1,
Point p2)
public void setP1(int x,
int y)
public void setP1(Point p1)
public void setP2(int x,
int y)
public void setP2(Point p2)
public Point getP1()
public int getX1()
public int getY1()
public Point getP2()
public int getX2()
public int getY2()
public void setThickness(int thickness)
public int getThickness()
public Rectangle getBounds()
getBounds in class Shapepublic void actualPaint(Graphics2D g)
Shapepaint(java.awt.Graphics2D) will forward to
this method.
actualPaint in class Shapeg - the instance of java.awt.Graphics2D that should
be used to paint the shape
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||