public class JDirectedLinkPainter extends JLinkPainter
The JDirectedLinkPainter
allows to draw directed links with arrow-tips at the destination end of
directed links.
The default length of the arrow-tip is DEFAULT_HEAD_LENGTH
and its opening angle is
defined by DEFAULT_HEAD_OPENING_ANGLE
.
When the link's length gets too small for the arrow to be properly displayed, the arrow-tip is gradually shrunken,
stopping at the DEFAULT_SHRUNKEN_ARROW_RATIO
ratio.
Note: the process of drawing the arrow-tip consumes more resources than the default behavior proposed by the
JLinkPainter
.
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_HEAD_LENGTH
The default length of the arrow-tip: .
|
static double |
DEFAULT_HEAD_OPENING_ANGLE
The default opening angle of the arrow-tip: .
|
static double |
DEFAULT_SHRUNKEN_ARROW_RATIO
The default shrunken ratio for the arrow-tip: .
|
Constructor and Description |
---|
JDirectedLinkPainter()
Creates a
JDirectedLinkPainter with default values. |
JDirectedLinkPainter(double headOpeningAngle,
double headLength,
double shrunkenArrowRatio)
Creates a
JDirectedLinkPainter . |
Modifier and Type | Method and Description |
---|---|
protected void |
drawDestinationPartIfNeeded(Graphics2D g2d,
Link link) |
protected void |
printDirectLinkEnd(Graphics2D g2d,
Point source,
Point destination,
double destinationIconSize) |
drawDirectedDestinationEnd, drawLink, isDirected, paintLink, setColor, setRenderingHints, setStroke
public static final double DEFAULT_HEAD_LENGTH
public static final double DEFAULT_HEAD_OPENING_ANGLE
public static final double DEFAULT_SHRUNKEN_ARROW_RATIO
public JDirectedLinkPainter()
JDirectedLinkPainter
with default values.public JDirectedLinkPainter(double headOpeningAngle, double headLength, double shrunkenArrowRatio)
JDirectedLinkPainter
.headOpeningAngle
- the opening angle of the arrow-tip (rad).headLength
- the length of the arrow-tip, as a double.shrunkenArrowRatio
- the ratio ot the normal length up to which the arrow-tip should be shrinkable, as a double.protected void drawDestinationPartIfNeeded(Graphics2D g2d, Link link)
drawDestinationPartIfNeeded
in class JLinkPainter
protected void printDirectLinkEnd(Graphics2D g2d, Point source, Point destination, double destinationIconSize)