public class HAnimation extends HStaticAnimation implements HNavigable
HAnimation class is a user
interface component used to display animated graphical content (as
HStaticAnimation) which
additionally enables a user to navigate to it, i.e. it can have the
input focus. By default it uses the HAnimateLook to render itself.
The HAnimation class supports
animating images in exactly the same way as the HStaticAnimation class, with the
following exception:
HAnimation has different
content set for the supported states a change in
interaction state may cause an implementation-specific change to
the animation position to deal with animation content of different
length.
| Parameter | Description | Default value | Set method | Get method |
|---|---|---|---|---|
| x | x-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
| y | y-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
| width | width of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
| height | height of this component in pixels (subject to layout management). | --- | java.awt.Component#setBounds | java.awt.Component#getBounds |
| images | The array of images to be used as the content for every state of this component. | null | setAnimateContent |
getAnimateContent |
| imagesNormal | The array of images to be used as the content for the HState.NORMAL_STATE state of this
component. |
null | setAnimateContent |
getAnimateContent |
| imagesFocused | The array of images to be used as the content for the focused states of this component. | null | setAnimateContent |
getAnimateContent |
| delay | The delay between the presentation of successive content in the animation, in units of 0.1 second | 1 (i.e. 0.1 seconds) | setDelay |
getDelay |
| repeatCount | The number of times that the animation is to be played. | REPEAT_INFINITE |
setRepeatCount |
getRepeatCount |
| playMode | The playing mode for the animation. | PLAY_REPEATING |
setPlayMode |
getPlayMode |
| Description | Default value | Set method | Get method |
|---|---|---|---|
Associated matte (HMatte). |
none (i.e. getMatte() returns null) |
setMatte |
getMatte |
| The text layout manager responsible for text formatting. | An HDefaultTextLayoutManager
object. |
HVisible.setTextLayoutManager(org.havi.ui.HTextLayoutManager)
|
HVisible.getTextLayoutManager()
|
| The background painting mode | HVisible.NO_BACKGROUND_FILL |
HVisible.setBackgroundMode(int) |
HVisible.getBackgroundMode() |
| The default preferred size | not set (i.e. NO_DEFAULT_SIZE) unless specified by width
and height parameters |
HVisible.setDefaultSize(java.awt.Dimension) |
HVisible.getDefaultSize() |
| The horizontal content alignment | HVisible.HALIGN_CENTER |
HVisible.setHorizontalAlignment(int) |
HVisible.getHorizontalAlignment() |
| The vertical content alignment | HVisible.VALIGN_CENTER |
HVisible.setVerticalAlignment(int) |
HVisible.getVerticalAlignment() |
| The content scaling mode | HVisible.RESIZE_NONE |
HVisible.setResizeMode(int) |
HVisible.getResizeMode() |
| The border mode | true |
HVisible.setBordersEnabled(boolean) |
HVisible.getBordersEnabled() |
| The initial piece of content to be presented, i.e. its position in the content array. | 0 | setPosition |
getPosition |
| By default the animation should be stopped. Hence, to start the animation its start method must be explicitly invoked. This mechanism allows for animations that are programmatically controlled, e.g. via the setPosition method. | "stopped" | start /
stop |
isAnimated |
| The default "look" for this class. | A platform specific HAnimateLook |
HAnimation.setDefaultLook |
HAnimation.getDefaultLook |
| The "look" for this object. | The HAnimateLook returned from
HAnimation.getDefaultLook when this object was created. |
HAnimation.setLook |
HAnimation.getLook |
| The gain focus sound. | null | setGainFocusSound |
getGainFocusSound |
| The lose focus sound. | null | setLoseFocusSound |
getLoseFocusSound |
HStaticAnimation,
HNavigable,
Serialized FormComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyADJUSTMENT_VALUE_CHANGE, ANIMATE_CONTENT_CHANGE, ANIMATION_POSITION_CHANGE, BACKGROUND_FILL, BORDER_CHANGE, CARET_POSITION_CHANGE, CONTENT_CHANGE, ECHO_CHAR_CHANGE, EDIT_MODE_CHANGE, FIRST_CHANGE, GRAPHIC_CONTENT_CHANGE, HALIGN_CENTER, HALIGN_JUSTIFY, HALIGN_LEFT, HALIGN_RIGHT, ITEM_VALUE_CHANGE, LAST_CHANGE, LIST_CONTENT_CHANGE, LIST_ICONSIZE_CHANGE, LIST_LABELSIZE_CHANGE, LIST_MULTISELECTION_CHANGE, LIST_SCROLLPOSITION_CHANGE, LIST_SELECTION_CHANGE, MIN_MAX_CHANGE, NO_BACKGROUND_FILL, NO_DEFAULT_HEIGHT, NO_DEFAULT_SIZE, NO_DEFAULT_WIDTH, ORIENTATION_CHANGE, REPEAT_COUNT_CHANGE, RESIZE_ARBITRARY, RESIZE_NONE, RESIZE_PRESERVE_ASPECT, SIZE_CHANGE, STATE_CHANGE, TEXT_CONTENT_CHANGE, TEXT_VALUE_CHANGE, THUMB_OFFSETS_CHANGE, UNKNOWN_CHANGE, VALIGN_BOTTOM, VALIGN_CENTER, VALIGN_JUSTIFY, VALIGN_TOPBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTPLAY_ALTERNATING, PLAY_REPEATING, REPEAT_INFINITEACTIONED_FOCUSED_STATE, ACTIONED_STATE, ACTIONED_STATE_BIT, ALL_STATES, DISABLED_ACTIONED_FOCUSED_STATE, DISABLED_ACTIONED_STATE, DISABLED_FOCUSED_STATE, DISABLED_STATE, DISABLED_STATE_BIT, FIRST_STATE, FOCUSED_STATE, FOCUSED_STATE_BIT, LAST_STATE, NORMAL_STATEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
HAnimation()
Creates an HAnimation object.
|
HAnimation(Image[] imagesNormal,
Image[] imagesFocused,
int delay,
int playMode,
int repeatCount)
Creates an HAnimation object.
|
HAnimation(Image[] imagesNormal,
Image[] imagesFocused,
int delay,
int playMode,
int repeatCount,
int x,
int y,
int width,
int height)
Creates an HAnimation object.
|
HAnimation(Image[] images,
int delay,
int playMode,
int repeatCount)
Creates an HAnimation object.
|
HAnimation(Image[] images,
int delay,
int playMode,
int repeatCount,
int x,
int y,
int width,
int height)
Creates an HAnimation object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHFocusListener(HFocusListener l)
Adds the specified
HFocusListener to
receive HFocusEvent events sent from
this HNavigable: If the listener has
already been added further calls will add further references to the listener,
which will then receive multiple copies of a single event. |
static HAnimateLook |
getDefaultLook()
Returns the currently set default look for HAnimation
components.
|
HSound |
getGainFocusSound()
Get the sound associated with the gain focus event.
|
HSound |
getLoseFocusSound()
Get the sound associated with the lost focus event.
|
HNavigable |
getMove(int keyCode)
Provides the
HNavigable object
that is navigated to when a particular key is pressed. |
int[] |
getNavigationKeys()
Retrieve the set of key codes which this component maps to
navigation targets.
|
boolean |
isSelected()
Indicates if this component has focus.
|
void |
processHFocusEvent(HFocusEvent evt)
Process an
HFocusEvent sent to this HAnimation. |
void |
removeHFocusListener(HFocusListener l)
Removes the specified
HFocusListener
so that it no longer receives HFocusEvent events from this HNavigable. |
static void |
setDefaultLook(HAnimateLook hlook)
Sets the default
HLook for further
HAnimation Components. |
void |
setFocusTraversal(HNavigable up,
HNavigable down,
HNavigable left,
HNavigable right)
Set the focus control for an
HNavigable component. |
void |
setGainFocusSound(HSound sound)
Associate a sound with gaining focus, i.e.
|
void |
setLoseFocusSound(HSound sound)
Associate a sound with losing focus, i.e.
|
void |
setMove(int keyCode,
HNavigable target)
Defines the navigation path from the current
HNavigable to another HNavigable when a particular key is
pressed. |
getDelay, getPlayMode, getPosition, getRepeatCount, isAnimated, setDelay, setLook, setPlayMode, setPosition, setRepeatCount, start, stopgetAnimateContent, getBackgroundMode, getBordersEnabled, getContent, getDefaultSize, getGraphicContent, getHorizontalAlignment, getInteractionState, getLook, getLookData, getMaximumSize, getMinimumSize, getPreferredSize, getResizeMode, getTextContent, getTextLayoutManager, getVerticalAlignment, isFocusTraversable, isOpaque, paint, setAnimateContent, setBackgroundMode, setBordersEnabled, setContent, setDefaultSize, setEnabled, setGraphicContent, setHorizontalAlignment, setInteractionState, setLookData, setResizeMode, setTextContent, setTextLayoutManager, setVerticalAlignment, updategetMatte, isDoubleBuffered, isEnabled, processEvent, setMatteaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validatepublic HAnimation()
public HAnimation(Image[] images, int delay, int playMode, int repeatCount, int x, int y, int width, int height)
public HAnimation(Image[] imagesNormal, Image[] imagesFocused, int delay, int playMode, int repeatCount, int x, int y, int width, int height)
public HAnimation(Image[] images, int delay, int playMode, int repeatCount)
public HAnimation(Image[] imagesNormal, Image[] imagesFocused, int delay, int playMode, int repeatCount)
public static void setDefaultLook(HAnimateLook hlook)
HLook for further
HAnimation Components.public static HAnimateLook getDefaultLook()
HLook that is used by
default when creating a new HAnimation component.public void setMove(int keyCode,
HNavigable target)
HNavigable to another HNavigable when a particular key is
pressed. Note that setFocusTraversal is
equivalent to multiple calls to setMove, where the key codes
VK_UP, VK_DOWN, VK_LEFT,
VK_RIGHT are used.
setMove in interface HNavigablekeyCode - The key code of the pressed key. Any numerical
keycode is allowed, but the platform may not be able to
generate all keycodes. Application authors should only use keys
for which HRcCapabilities.isSupported() or
HKeyCapabilities.isSupported() returns true.target - The target HNavigable object that should be navigated to. If a target is
to be removed from a particular navigation path, then
null shall be specified.public HNavigable getMove(int keyCode)
HNavigable object
that is navigated to when a particular key is pressed.getMove in interface HNavigablekeyCode - The key code of the pressed key.HNavigable
object or null if no HNavigable is associated with the keyCode.public void setFocusTraversal(HNavigable up, HNavigable down, HNavigable left, HNavigable right)
HNavigable component. Note setFocusTraversal is a
convenience function for application programmers where a standard
up, down, left and right focus traversal between components is
required.
Note setFocusTraversal is equivalent to multiple calls to setMove, where the key codes
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT are used.
Note that this
API does not prevent the creation of "isolated"
HNavigable components --- authors
should endeavor to avoid confusing the user.
setFocusTraversal in interface HNavigableup - The HNavigable component
to move to, when the user generates a VK_UP KeyEvent. If there is no HNavigable component to move
"up" to, then null shall be specified.down - The HNavigable
component to move to, when the user generates a VK_DOWN KeyEvent. If there
is no HNavigable component to move
"down" to, then null shall be specified.left - The HNavigable
component to move to, when the user generates a VK_LEFT KeyEvent. If there
is no HNavigable component to move
"left" to, then null shall be specified.right - The HNavigable
component to move to, when the user generates a VK_RIGHT KeyEvent. If there
is no HNavigable component to move
"right" to, then null shall be specified.public boolean isSelected()
isSelected in interface HNavigabletrue if the component has focus, otherwise
returns false.public void setGainFocusSound(HSound sound)
HNavigable receives a
HFocusEvent event of type
FOCUS_GAINED. This sound will start to be played
when an object implementing this interface gains focus. It is
not guaranteed to be played to completion. If the object
implementing this interface loses focus before the audio
completes playing, the audio will be truncated. Applications
wishing to ensure the audio is always played to completion must
implement special logic to slow down the focus transitions.
By default, an HNavigable object
does not have any gain focus sound associated with it.
Note that the ordering of playing sounds is dependent on the order of the focus lost, gained events.
setGainFocusSound in interface HNavigablesound - the sound to be played, when the component gains
focus. If sound content is already set, the original content is
replaced. To remove the sound specify a null HSound.public void setLoseFocusSound(HSound sound)
HNavigable receives a
HFocusEvent event of type
FOCUS_LOST. This sound will start to be played when an object
implementing this interface loses focus. It is not guaranteed to be
played to completion. It is implementation dependent whether and when
this sound will be truncated by any gain focus sound played by the next
object to gain focus. By default, an HNavigable object does not have any
lose focus sound associated with it.
Note that the ordering of playing sounds is dependent on the order of the focus lost, gained events.
setLoseFocusSound in interface HNavigablesound - the sound to be played, when the component loses
focus. If sound content is already set, the original content is
replaced. To remove the sound specify a null HSound.public HSound getGainFocusSound()
getGainFocusSound in interface HNavigablepublic HSound getLoseFocusSound()
getLoseFocusSound in interface HNavigablepublic void addHFocusListener(HFocusListener l)
HFocusListener to
receive HFocusEvent events sent from
this HNavigable: If the listener has
already been added further calls will add further references to the listener,
which will then receive multiple copies of a single event.addHFocusListener in interface HNavigablel - the HFocusListener to addpublic void removeHFocusListener(HFocusListener l)
HFocusListener
so that it no longer receives HFocusEvent events from this HNavigable. If
the specified listener is not registered, the method has no effect. If
multiple references to a single listener have been registered it should be
noted that this method will only remove one reference per call.removeHFocusListener in interface HNavigablel - the HFocusListener to removepublic int[] getNavigationKeys()
getNavigationKeys in interface HNavigationInputPreferrednull if no
navigation targets are set on this component.public void processHFocusEvent(HFocusEvent evt)
HFocusEvent sent to this HAnimation.processHFocusEvent in interface HNavigationInputPreferredevt - the HFocusEvent to process.Copyright © 2012 code4tv.com. All Rights Reserved.