uk.ac.starlink.xdoc.fig
Class Arrow

java.lang.Object
  extended by uk.ac.starlink.xdoc.fig.Arrow
Direct Known Subclasses:
Arrow.FilledArrow

public abstract class Arrow
extends Object

Draws arrows.

Since:
18 Sep 2007
Author:
Mark Taylor

Nested Class Summary
static class Arrow.FilledArrow
          Arrow instance with a filled triangular head.
 
Constructor Summary
Arrow()
           
 
Method Summary
static Arrow createFilledArrow(int lpar, int lperp)
          Returns an arrow instance with a filled head.
protected abstract  void drawArrow(Graphics2D g2, int x1)
          Does the shape-specific work of drawing the arrow.
 void drawArrow(Graphics2D g2, int x1, int y1, int x2, int y2)
          Draws an arrow.
 void setPad(int pad)
          Sets padding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arrow

public Arrow()
Method Detail

drawArrow

public void drawArrow(Graphics2D g2,
                      int x1,
                      int y1,
                      int x2,
                      int y2)
Draws an arrow. The positions specified here may not be the actual positions of the head and tail; if padding is in use they will stop short of those.

Parameters:
g2 - graphics context
x1 - nominal X coordinate of start (tail) position
y1 - nominal Y coordinate of start (tail) position
x2 - nominal X coordinate of end (head) position
y2 - nominal Y coordinate of end (head) position

drawArrow

protected abstract void drawArrow(Graphics2D g2,
                                  int x1)
Does the shape-specific work of drawing the arrow. Draws an arrow line and head from (x1, 0) to the origin.

Parameters:
g2 - graphics context
x1 - X coordinate of tail of arrow; x1 >= 0

setPad

public void setPad(int pad)
Sets padding. This is the number of pixels to leave blank at each end of the arrow trajectory.

Parameters:
pad - padding in pixels

createFilledArrow

public static Arrow createFilledArrow(int lpar,
                                      int lperp)
Returns an arrow instance with a filled head.

Parameters:
lpar - head length parallel to the trajectory
lperp - head half-width perpendicular to the trajectory


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.