public class AnimatedImage extends StyledWidget
Image
,
ImageLoader
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
AnimatedImage(java.lang.String[] frames,
long period)
Creates an animated image with the path to the images to display.
|
AnimatedImage(java.lang.String frames,
long period)
Creates an animated image with the path to the images to display.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getFrames()
Gets the frames.
|
long |
getPeriod()
Gets the period.
|
void |
hideNotify() |
void |
renderContent(ej.microui.display.GraphicsContext g,
Style style,
Rectangle availableBounds)
Renders the content of the renderable without the border, margin and padding specified in the style.
|
void |
setFrames(java.lang.String[] frames)
Sets the frames to display for this animated image.
|
void |
setPeriod(long period)
Sets the period.
|
void |
showNotify() |
Rectangle |
validateContent(Style style,
Rectangle availableBounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getContentBounds, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidgetAt, getWidth, getX, getY, handleEvent, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, requestFocus, requestFocus, revalidate, revalidateSubTree, setBounds, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
public AnimatedImage(java.lang.String[] frames, long period)
The image loader service is used to load the images from the given paths.
frames
- the paths to the frames to display.period
- the period between each image.java.lang.NullPointerException
- if the given frames array is null
.java.lang.IllegalArgumentException
- if the given frames array is empty.java.lang.IllegalArgumentException
- if the given period is lower or equal to zero.ImageLoader.getImage(String)
public AnimatedImage(java.lang.String frames, long period)
The image loader service is used to load the images from the given paths.
The given sources string is a space separated list of paths.
frames
- the paths to the frames to display.period
- the period between each image.java.lang.NullPointerException
- if the given frames string is null
.java.lang.IllegalArgumentException
- if the given frames string is empty.java.lang.IllegalArgumentException
- if the given period is lower or equal to zero.ImageLoader.getImage(String)
public void setPeriod(long period)
period
- the period to set.java.lang.IllegalArgumentException
- if the given period is lower or equal to zero.public long getPeriod()
public void setFrames(java.lang.String[] frames)
frames
- the path to the frames to display.java.lang.NullPointerException
- if the given frames array is null
.java.lang.IllegalArgumentException
- if the given frames array is empty.ImageLoader.getImage(String)
public java.lang.String[] getFrames()
public void showNotify()
showNotify
in interface ej.mwt.Renderable
showNotify
in class ej.mwt.Widget
public void hideNotify()
hideNotify
in interface ej.mwt.Renderable
hideNotify
in class ej.mwt.Widget
public void renderContent(ej.microui.display.GraphicsContext g, Style style, Rectangle availableBounds)
StyledRenderable
The given graphics context is translated and clipped according to the given bounds (the border, margin and padding are applied on this graphics context before).
g
- the graphics context where to render the content of the renderable.style
- the style to use.availableBounds
- the remaining size to render the content.Outline.apply(GraphicsContext, Rectangle)
,
Border.apply(GraphicsContext, Rectangle, int)
,
StyleHelper.renderWithoutContent(GraphicsContext, Rectangle, Style)
public Rectangle validateContent(Style style, Rectangle availableBounds)
StyledRenderable
style
- the style to use.availableBounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.