org.opensourcephysics.display
Class InteractiveImage

java.lang.Object
  extended by org.opensourcephysics.display.AbstractInteractive
      extended by org.opensourcephysics.display.InteractiveShape
          extended by org.opensourcephysics.display.InteractiveImage
All Implemented Interfaces:
java.awt.image.ImageObserver, Drawable, Interactive, Measurable

public class InteractiveImage
extends InteractiveShape
implements java.awt.image.ImageObserver

An image is bounded by hot spots for dragging and resizing.

Version:
1.0
Author:
W. Christian

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveShape
InteractiveShape.InteractiveShapeLoader
 
Field Summary
protected  java.awt.Image image
           
 
Fields inherited from class org.opensourcephysics.display.InteractiveShape
edgeColor, height, pixelSized, shape, shapeClass, theta, width, xoff, yoff
 
Fields inherited from class org.opensourcephysics.display.AbstractInteractive
color, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
InteractiveImage(java.awt.Image image, double x, double y)
          Constructs an interactive image centered at the given location.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the image.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
           
 boolean isInside(DrawingPanel panel, int xpix, int ypix)
          Determines if the shape is enabled and if the given pixel coordinates are within the image.
 
Methods inherited from class org.opensourcephysics.display.InteractiveShape
contains, createArrow, createCenteredArrow, createCircle, createEllipse, createImage, createRectangle, createSquare, createTextLine, createTriangle, getHeight, getLoader, getShape, getWidth, getXMax, getXMin, getYMax, getYMin, isMeasured, setHeight, setMarkerColor, setMeasured, setOffset, setPixelSized, setTheta, setWidth, setX, setXY, setY, toString, tranform, transform
 
Methods inherited from class org.opensourcephysics.display.AbstractInteractive
findInteractive, getX, getY, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

image

protected java.awt.Image image
Constructor Detail

InteractiveImage

public InteractiveImage(java.awt.Image image,
                        double x,
                        double y)
Constructs an interactive image centered at the given location.

Parameters:
x - double
y - double
image - Image
Method Detail

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 image.

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

draw

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

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

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver