edu.rit.slides.items
Class Arrow

java.lang.Object
  extended by edu.rit.slides.items.Arrow
All Implemented Interfaces:
Externalizable, Serializable

public class Arrow
extends Object
implements Externalizable

Class Arrow provides various kinds of arrowheads that can be added to the ends of a LineItem.

See Also:
Serialized Form

Field Summary
static Arrow NONE
          A nonexistent arrow.
static Arrow OPEN
          An open arrow in the shape of a narrow triangle.
static Arrow SOLID
          A solid arrow in the shape of a narrow triangle.
 
Constructor Summary
Arrow()
          Construct a new nonexistent arrow.
 
Method Summary
 void draw(Graphics2D g2d, float width, double x, double y, double phi)
          Draw this arrow in the given graphics context.
 void readExternal(ObjectInput in)
          Read this arrow from the given object input stream.
 void writeExternal(ObjectOutput out)
          Write this arrow to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final Arrow NONE
A nonexistent arrow.


SOLID

public static final Arrow SOLID
A solid arrow in the shape of a narrow triangle.


OPEN

public static final Arrow OPEN
An open arrow in the shape of a narrow triangle.

Constructor Detail

Arrow

public Arrow()
Construct a new nonexistent arrow.

Method Detail

draw

public void draw(Graphics2D g2d,
                 float width,
                 double x,
                 double y,
                 double phi)
Draw this arrow in the given graphics context. It assumes the graphics context's stroke and paint are already set to the correct values. The arrow is scaled to match the width. The arrow's tip is placed at the coordinates (x,y). The arrow is rotated so it points in the direction given by phi.

Parameters:
g2d - 2-D graphics context.
width - Stroke width.
x - X coordinate of the arrow's tip.
y - Y coordinate of the arrow's tip.
phi - Angle in which the arrow points (radians).

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this arrow to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Read this arrow from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.