public class GifIcon extends Object implements Icon, DisabledCopySupplier<GifIcon>, TransparentCopySupplier<GifIcon>
Icon implementation.GifDecoder,
GifEncoder| Modifier and Type | Field and Description |
|---|---|
protected int |
displayedFrame
Currently displayed
GifFrame index. |
protected List<GifFrame> |
frames
|
protected Thread |
gifAnimator
|
protected List<FrameChangeListener> |
listeners
List of FrameChangeListeners. |
protected int |
status
GifIcon loading status. |
| Constructor and Description |
|---|
GifIcon(GifFrame... frames)
Constructs new
GifIcon. |
GifIcon(InputStream inputStream)
Constructs new
GifIcon. |
GifIcon(List<GifFrame> frames)
Constructs new
GifIcon. |
GifIcon(Resource resource)
Constructs new
GifIcon. |
| Modifier and Type | Method and Description |
|---|---|
void |
addFrameChangeListener(FrameChangeListener listener)
Adds specified
FrameChangeListener. |
GifIcon |
createDisabledCopy()
Returns copy of this
GifIcon with only first frame made look disabled. |
GifIcon |
createTransparentCopy(float opacity)
Returns copy of this
GifIcon with only first frame made semi-transparent. |
void |
fireFrameChanged(int index)
Fires displayed
GifFrame change. |
int |
getDisplayedFrame()
Returns currently displayed
GifFrame index. |
BufferedImage |
getDisplayedImage()
Returns currently displayed
BufferedImage. |
GifFrame |
getFrame(int index)
Returns
GifFrame at the specified index. |
int |
getFrameCount()
Returns
GifIcon frame count. |
List<GifFrame> |
getFrames()
|
int |
getIconHeight() |
int |
getIconWidth() |
int |
getStatus()
Returns
GifIcon loading status. |
void |
paintIcon(Component c,
Graphics g,
int x,
int y) |
void |
removeFrameChangeListener(FrameChangeListener listener)
Removes specified
FrameChangeListener. |
void |
startAnimation()
Starts animation
Thread. |
void |
stopAnimation()
Stops animation
Thread. |
protected final int status
GifIcon loading status.@NotNull protected List<FrameChangeListener> listeners
List of FrameChangeListeners.protected transient int displayedFrame
GifFrame index.public GifIcon(@NotNull Resource resource)
GifIcon.resource - GIF Resourcepublic GifIcon(@NotNull InputStream inputStream)
GifIcon.inputStream - GIF InputStreampublic GifIcon(@NotNull GifFrame... frames)
GifIcon.frames - GifFramespublic int getStatus()
GifIcon loading status.GifIcon loading statusGifDecoder.STATUS_OK,
GifDecoder.STATUS_FORMAT_ERROR,
GifDecoder.STATUS_OPEN_ERRORpublic int getDisplayedFrame()
GifFrame index.GifFrame index@NotNull public BufferedImage getDisplayedImage()
BufferedImage.BufferedImagepublic void startAnimation()
Thread.public void stopAnimation()
Thread.public int getIconWidth()
getIconWidth in interface Iconpublic int getIconHeight()
getIconHeight in interface Iconpublic void addFrameChangeListener(@NotNull FrameChangeListener listener)
FrameChangeListener.listener - FrameChangeListener to addpublic void removeFrameChangeListener(@NotNull FrameChangeListener listener)
FrameChangeListener.listener - FrameChangeListener to removepublic void fireFrameChanged(int index)
GifFrame change.index - new displayed GifFrame index@NotNull public GifIcon createDisabledCopy()
GifIcon with only first frame made look disabled.createDisabledCopy in interface DisabledCopySupplier<GifIcon>GifIcon with only first frame made look disabled@NotNull public GifIcon createTransparentCopy(float opacity)
GifIcon with only first frame made semi-transparent.createTransparentCopy in interface TransparentCopySupplier<GifIcon>opacity - opacity value, must be between 0 and 1GifIcon with only first frame made semi-transparentCopyright © 2020. All rights reserved.