org.opensourcephysics.display
Class InteractiveArrow

java.lang.Object
  extended by org.opensourcephysics.display.AbstractInteractive
      extended by org.opensourcephysics.display.InteractiveShape
          extended by org.opensourcephysics.display.BoundedShape
              extended by org.opensourcephysics.display.InteractiveArrow
All Implemented Interfaces:
Drawable, Interactive, Measurable, Selectable

public class InteractiveArrow
extends BoundedShape


Field Summary
 
Fields inherited from class org.opensourcephysics.display.InteractiveShape
edgeColor
 
Fields inherited from class org.opensourcephysics.display.AbstractInteractive
color
 
Constructor Summary
InteractiveArrow(double x, double y, double w, double h)
          Constructor InteractiveArrow
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the arrow.
static XML.ObjectLoader getLoader()
          Gets the XML object loader for this class.
 java.awt.Cursor getPreferredCursor()
          Gets the cursor depending on the current hot spot.
 boolean isInside(DrawingPanel panel, int xpix, int ypix)
          Determines if the shape is enabled and if the given pixel coordinates are within the shape.
 void setOffset(double xoffset, double yoffset)
          Drawing offset not supported.
 void setStrokeWidth(double width)
          Sets the stroke for rendering fat arrows.
 void setTheta(double theta)
          Rotates the arrow without changing its length.
 void setWidthHeight(double width, double height)
          Sets the origin, width (horizontal) and height (vertical) components of this arrow.
 
Methods inherited from class org.opensourcephysics.display.BoundedShape
createBoundedArrow, createBoundedCenteredArrow, createBoundedCircle, createBoundedEllipse, createBoundedImage, createBoundedRectangle, createBoundedTriangle, findInteractive, isHeightDrag, isRotateDrag, isSelected, isWidthDrag, isXYDrag, setHeightDrag, setRotateDrag, setSelected, setWidthDrag, setXYDrag, toggleSelected, toString
 
Methods inherited from class org.opensourcephysics.display.InteractiveShape
contains, createArrow, createCenteredArrow, createCircle, createEllipse, createImage, createRectangle, createSquare, createTextLine, createTriangle, getHeight, getShape, getWidth, getXMax, getXMin, getYMax, getYMin, isMeasured, setHeight, setMarkerColor, setMeasured, setPixelSized, setWidth, setX, setXY, setY, tranform, transform
 
Methods inherited from class org.opensourcephysics.display.AbstractInteractive
getX, getY, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY, isEnabled, setEnabled, setX, setXY, setY
 
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 

Constructor Detail

InteractiveArrow

public InteractiveArrow(double x,
                        double y,
                        double w,
                        double h)
Constructor InteractiveArrow

Parameters:
x -
y -
w -
h -
Method Detail

setStrokeWidth

public void setStrokeWidth(double width)
Sets the stroke for rendering fat arrows.

Parameters:
width - double

setOffset

public void setOffset(double xoffset,
                      double yoffset)
Drawing offset not supported.

Overrides:
setOffset in class InteractiveShape
Parameters:
xoffset - double
yoffset - double

isInside

public boolean isInside(DrawingPanel panel,
                        int xpix,
                        int ypix)
Determines if the shape is enabled and if the given pixel coordinates are within the shape.

Overrides:
isInside in class BoundedShape
Parameters:
panel - DrawingPanel
xpix - int
ypix - int
Returns:
boolean

setTheta

public void setTheta(double theta)
Rotates the arrow without changing its length.

Overrides:
setTheta in class InteractiveShape
Parameters:
theta -

setWidthHeight

public void setWidthHeight(double width,
                           double height)
Sets the origin, width (horizontal) and height (vertical) components of this arrow.

Parameters:
width - double
height - double

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the arrow.

Specified by:
draw in interface Drawable
Overrides:
draw in class BoundedShape
Parameters:
panel - the world in which the arrow is viewed
g - the graphics context upon which to draw

getPreferredCursor

public java.awt.Cursor getPreferredCursor()
Gets the cursor depending on the current hot spot.

Specified by:
getPreferredCursor in interface Selectable
Overrides:
getPreferredCursor in class BoundedShape
Returns:
Cursor

getLoader

public static XML.ObjectLoader getLoader()
Gets the XML object loader for this class.

Returns:
ObjectLoader