|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.ui.icon.AnimatedIcon
public abstract class AnimatedIcon
javax.swing.Icon implementation that manages animation.
This heavily borrows code from Technomage's furbelow package, distributed
under the GNU Lesser General Public License.
The original source code can be found here.
| Field Summary | |
|---|---|
static int |
DEFAULT_FRAME_COUNT
Default number of frames per animation. |
static int |
DEFAULT_FRAME_DELAY
Default number of milliseconds between each frame. |
| Constructor Summary | |
|---|---|
AnimatedIcon()
Creates a new animated icon. |
|
AnimatedIcon(int frameCount)
Creates a new animated icon with the specified number of frames. |
|
AnimatedIcon(int frameCount,
int repaintDelay)
Creates a new animated icon with the specified number of frames and repaint delay. |
|
| Method Summary | |
|---|---|
protected void |
finalize()
|
int |
getFrame()
Returns the index of the current frame in the animation. |
int |
getFrameCount()
Returns the total number of frames in the animation. |
int |
getFrameDelay()
Returns the number of milliseconds the animation will sleep between each frame. |
abstract int |
getIconHeight()
Returns the icon's height. |
abstract int |
getIconWidth()
Returns the icon's width. |
boolean |
isAnimated()
Returns true if the animation is currently running. |
void |
nextFrame()
Takes the animation to its next frame. |
protected abstract void |
paintFrame(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the current frame. |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the icon's current frame. |
protected void |
repaint()
Forces the icon to repaint. |
void |
setAnimated(boolean a)
Starts / stops the animation. |
void |
setFrame(int frame)
Sets the index of the current frame in the animation. |
void |
setFrameCount(int count)
Sets the total number of frames in the animation. |
void |
setFrameDelay(int delay)
Sets the number of milliseconds the animation will sleep between each frame. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_FRAME_COUNT
public static final int DEFAULT_FRAME_DELAY
| Constructor Detail |
|---|
public AnimatedIcon()
This is a convenience constructor and is strictly equivalent to calling
AnimatedIcon(int,int)(DEFAULT_FRAME_COUNT, DEFAULT_FRAME_DELAY);
public AnimatedIcon(int frameCount)
This is a convenience constructor and is strictly equivalent to calling
AnimatedIcon(int,int)(frameCount, DEFAULT_FRAME_DELAY);
frameCount - number of frames in the animation.
public AnimatedIcon(int frameCount,
int repaintDelay)
frameCount - number of frames in the animation.repaintDelay - number of milliseconds to sleep between each frame.| Method Detail |
|---|
public abstract int getIconWidth()
getIconWidth in interface javax.swing.Iconpublic abstract int getIconHeight()
getIconHeight in interface javax.swing.Icon
protected abstract void paintFrame(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
c - component in which the frame is being painted.g - graphics in which to paint the frame.x - horizontal coordinate at which to paint the frame.y - vertical coordinate at which to paint the frame.public void setFrameCount(int count)
count - total number of frames in the animation.public int getFrameCount()
public int getFrame()
public void setFrame(int frame)
If the method does actually change the current frame, it will trigger a repaint.
frame - index of the current frame in the animation.public void nextFrame()
This is a convenience method and is strictly equivalent to calling
.
setFrame(getFrame() + 1)
public void setFrameDelay(int delay)
If set to 0, the animation will stop.
delay - number of milliseconds the animation will sleep between each frame.public void setAnimated(boolean a)
a - whether the animation should be started or stopped.public boolean isAnimated()
true if the animation is currently running.
Note that this method will return true if the animation is meant to be running,
for example if the icon is not visible but would be animated if it was.
true if the animation is currently running, false.public int getFrameDelay()
public void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paintIcon in interface javax.swing.Iconc - component in which to paint the icon.g - graphic context in which to paint the icon.x - horizontal coordinate at which to paint the icon.y - vertical coordinate at which to paint the icon.protected void repaint()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard