public class CurvedArrow
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.AffineTransform |
affineToText
The affine transform for getting us to the text space.
|
protected java.awt.geom.Rectangle2D |
bounds
The stored bounds.
|
protected java.awt.Point |
control
The start, end, and single control points.
|
protected java.awt.geom.QuadCurve2D.Float |
curve
The quad-curve that controls the shape of the long part of the arrow.
|
protected float |
curvy
The "curvy-ness" factor.
|
protected java.awt.Point |
end
The start, end, and single control points.
|
protected boolean |
endArrow
Arrow flags.
|
protected static java.awt.Graphics |
GRAPHICS
A graphics object.
|
static java.awt.Color |
HIGHLIGHT_COLOR |
protected java.lang.String |
label
The label for this arrow.
|
protected static java.awt.FontMetrics |
METRICS
A font metrics object.
|
protected boolean |
needsRefresh
true if the curve needs to be refreshed, false
otherwise. |
protected java.awt.Point |
start
The start, end, and single control points.
|
protected boolean |
startArrow
Arrow flags.
|
| Constructor and Description |
|---|
CurvedArrow(int x1,
int y1,
int x2,
int y2,
float curvy)
Instantiates a
CurvedArrow object. |
CurvedArrow(java.awt.Point start,
java.awt.Point end,
float curvy)
Instantiates a
CurvedArrow object. |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(java.awt.Graphics2D g)
Draws the arrow on the indicated graphics environment.
|
void |
drawControlPoint(java.awt.Graphics2D g) |
void |
drawHighlight(java.awt.Graphics2D g)
Draws a highlight of the curve.
|
void |
drawText(java.awt.Graphics2D g)
Draws the text on the high point of the arc.
|
java.awt.geom.Rectangle2D |
getBounds()
Returns the bounds.
|
java.awt.geom.QuadCurve2D |
getCurve() |
java.lang.String |
getLabel()
Returns the label for this arrow.
|
boolean |
isNear(java.awt.Point point,
int fudge)
Determines if a point is on/near the curved arrow.
|
void |
refreshCurve()
Refreshes the curve object.
|
void |
setCurvy(float curvy)
Sets the "curvy-ness" factor.
|
void |
setEnd(int x2,
int y2)
Sets the end point.
|
void |
setEnd(java.awt.Point end)
Sets the end point.
|
void |
setLabel(java.lang.String label)
Sets the label that will be drawn on the high arc point.
|
void |
setStart(int x1,
int y1)
Sets the start point.
|
void |
setStart(java.awt.Point start)
Sets the start point.
|
protected java.awt.Point start
protected java.awt.Point end
protected java.awt.Point control
protected float curvy
protected java.awt.geom.QuadCurve2D.Float curve
protected boolean needsRefresh
true if the curve needs to be refreshed, false
otherwise.protected boolean startArrow
protected boolean endArrow
protected java.lang.String label
protected java.awt.geom.Rectangle2D bounds
protected java.awt.geom.AffineTransform affineToText
protected static java.awt.Graphics GRAPHICS
protected static java.awt.FontMetrics METRICS
public static java.awt.Color HIGHLIGHT_COLOR
public CurvedArrow(int x1,
int y1,
int x2,
int y2,
float curvy)
CurvedArrow object.x1 - the x coordinate of the start pointy1 - the y coordinate of the start pointx2 - the x coordinate of the end pointy2 - the y coordinate of the end pointcurvy - the curvi-ness factor; 0 will create a straight line; 1 and -1
are rather curvypublic CurvedArrow(java.awt.Point start,
java.awt.Point end,
float curvy)
CurvedArrow object.start - the start pointend - the end pointcurvy - the curvi-ness factor; 0 will create a straight line; 1 and -1
are rather curvypublic void setStart(int x1,
int y1)
x1 - the x coordinate of the start pointy1 - the y coordinate of the start pointpublic void setStart(java.awt.Point start)
start - the new start pointpublic void setEnd(int x2,
int y2)
x2 - the x coordinate of the end pointy2 - the y coordinate of the end pointpublic void setEnd(java.awt.Point end)
end - the new end pointpublic void setCurvy(float curvy)
curvy - the new curvy factorpublic void draw(java.awt.Graphics2D g)
g - the graphics to draw this arrow uponpublic void drawControlPoint(java.awt.Graphics2D g)
public void drawHighlight(java.awt.Graphics2D g)
g - the graphics to draw the highlight of the curve uponpublic void drawText(java.awt.Graphics2D g)
getLabel.g - the graphics object to draw the text uponpublic void setLabel(java.lang.String label)
label - the new label for the arrowpublic java.lang.String getLabel()
public void refreshCurve()
public java.awt.geom.Rectangle2D getBounds()
public boolean isNear(java.awt.Point point,
int fudge)
point - the point to checkfudge - the radius around the point that should be checked for the
presence of the curvepublic java.awt.geom.QuadCurve2D getCurve()