Documentation of 'edu.rit.draw.item.Arrow' Java class
Arrow
edu.rit.draw.item

Class Arrow

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable


    public class Arrow
    extends java.lang.Object
    implements java.io.Externalizable
    Class Arrow provides various kinds of arrowheads that can be added to the ends of a Line.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      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

      Constructors 
      Constructor and Description
      Arrow()
      Construct a new nonexistent arrow.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void draw(java.awt.Graphics2D g2d, float width, double x, double y, double phi)
      Draw this arrow in the given graphics context.
      void readExternal(java.io.ObjectInput in)
      Read this arrow from the given object input stream.
      void writeExternal(java.io.ObjectOutput out)
      Write this arrow to the given object output stream.
      • Methods inherited from class java.lang.Object

        equals, 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

      • writeExternal

        public void writeExternal(java.io.ObjectOutput out)
                           throws java.io.IOException
        Write this arrow to the given object output stream.
        Specified by:
        writeExternal in interface java.io.Externalizable
        Parameters:
        out - Object output stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • readExternal

        public void readExternal(java.io.ObjectInput in)
                          throws java.io.IOException
        Read this arrow from the given object input stream.
        Specified by:
        readExternal in interface java.io.Externalizable
        Parameters:
        in - Object input stream.
        Throws:
        java.io.IOException - Thrown if an I/O error occurred.
      • draw

        public void draw(java.awt.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).

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.