|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.swing.animation.Animation
public class Animation
"Mix-in" Animation Support. This mix-in will draw on the owner's surface at specified intervals. The owner must specify where the image is to be drawn and then this class will load and render the image. Where multiple images are available an animation will result.
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.
$Revision: 1.5 $
| Field Summary | |
|---|---|
protected Project |
currentProject
The owner project and the context in which this object operates. |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
Animation()
Create a new animation |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.String fileName)
Adds a picture to the current animation. |
void |
add(int index,
java.lang.String fileName,
boolean fetchNow)
Adds a picture to the current animation. |
void |
displayImage(java.awt.Graphics g)
Draws the image at an offset of 0, 0. |
void |
displayImage(java.awt.Graphics g,
int xOff,
int yOff)
Draw the current image at the specified offsets. |
void |
first()
Sets the image index to the first image. |
int |
getIncrement()
Gets the interval between images in the animation. |
int |
getIndex()
Get the current image index |
int |
getNumImages()
Get the number of images in this animation |
void |
imageUpdate()
Update the image/component |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
This method is called when information about an image which was previously requested using an asynchronous interface becomes available. |
void |
last()
Sets the image index to the last image. |
void |
next()
Sets the image index to the next image. |
void |
paintComponent(java.awt.Graphics g)
Draws any images on the specified graphics context. |
void |
prev()
Sets the image index to the prev image. |
void |
purge()
Removes all images from the current animation. |
void |
remove(int index)
Removes the specified image from the list of images. |
void |
run()
Functions required for multi-threading. |
void |
setIncrement(int inc)
Sets the interval between images in the animation. |
void |
setIndex(int newPos)
Sets the index of the image to display. |
void |
setSleepTime(int st)
Sets the amount of time to wait before refreshing the image. |
void |
setValue(int index,
java.lang.String fileName)
Sets the image at the specified index. |
void |
startAnimation()
Starts the animation |
void |
stopAnimation()
Stops the animation. |
void |
update()
Causes the animation to repaint itself. |
void |
update(java.awt.Graphics g)
No need to clear anything; just paint. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Project currentProject
| Constructor Detail |
|---|
public Animation()
| Method Detail |
|---|
public void setSleepTime(int st)
st - the time to sleep.public void paintComponent(java.awt.Graphics g)
g - the graphics context.public void displayImage(java.awt.Graphics g)
g - the graphics context.
public void displayImage(java.awt.Graphics g,
int xOff,
int yOff)
g - the graphics context.xOff - the x offset,yOff - the y offset.
public boolean imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
This method should return true if further updates are needed or false if the required information has been acquired. The image which was being tracked is passed in using the img argument. Various constants are combined to form the infoflags argument which indicates what information about the image is now available. The interpretation of the x, y, width, and height arguments depends on the contents of the infoflags argument.
The infoflags argument should be the bitwise inclusive
OR of the following flags: WIDTH,
HEIGHT, PROPERTIES, SOMEBITS,
FRAMEBITS, ALLBITS, ERROR,
ABORT.
imageUpdate in interface java.awt.image.ImageObserverimg - the image being observed.infoflags - the bitwise inclusive OR of the following
flags: WIDTH, HEIGHT,
PROPERTIES, SOMEBITS,
FRAMEBITS, ALLBITS,
ERROR, ABORT.x - the x coordinate.y - the y coordinate.width - the width.height - the height.
false if the infoflags indicate that the
image is completely loaded; true otherwise.ImageObserver.WIDTH,
ImageObserver.HEIGHT,
ImageObserver.PROPERTIES,
ImageObserver.SOMEBITS,
ImageObserver.FRAMEBITS,
ImageObserver.ALLBITS,
ImageObserver.ERROR,
ImageObserver.ABORT,
Image.getWidth(java.awt.image.ImageObserver),
Image.getHeight(java.awt.image.ImageObserver),
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)public void run()
run in interface java.lang.Runnable
public void add(int index,
java.lang.String fileName)
index - the position at which the image is to be insertedfileName - the name of the file to display.
public void add(int index,
java.lang.String fileName,
boolean fetchNow)
index - the position at which the image is to be insertedfileName - the name of the file to display.fetchNow - get teh image now or wait till more images are addedpublic void first()
public void prev()
public void next()
public void last()
public void remove(int index)
index - the image indexpublic void setIncrement(int inc)
inc - the time in milliseconds between images.public int getIncrement()
public void setIndex(int newPos)
newPos - the index of the image.
public void setValue(int index,
java.lang.String fileName)
index - the number of the image to be changedfileName - the name of the new image.public int getNumImages()
public int getIndex()
public void startAnimation()
public void stopAnimation()
public void update()
public void imageUpdate()
public void update(java.awt.Graphics g)
g - the graphics contextpublic void purge()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||