de.enough.polish.ui
Class SpriteItem

java.lang.Object
  extended by javax.microedition.lcdui.Item
      extended by javax.microedition.lcdui.CustomItem
          extended by de.enough.polish.ui.SpriteItem

public class SpriteItem
extends javax.microedition.lcdui.CustomItem

Allows to use sprites within normal forms.

Copyright (c) Enough Software 2005 - 2008

 history
        15-Feb-2005 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class javax.microedition.lcdui.CustomItem
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL
 
Fields inherited from class javax.microedition.lcdui.Item
BUTTON, HYPERLINK, LAYOUT_2, LAYOUT_BOTTOM, LAYOUT_CENTER, LAYOUT_DEFAULT, LAYOUT_EXPAND, LAYOUT_LEFT, LAYOUT_NEWLINE_AFTER, LAYOUT_NEWLINE_BEFORE, LAYOUT_RIGHT, LAYOUT_SHRINK, LAYOUT_TOP, LAYOUT_VCENTER, LAYOUT_VEXPAND, LAYOUT_VSHRINK, PLAIN
 
Constructor Summary
SpriteItem(java.lang.String label, javax.microedition.lcdui.game.Sprite sprite, long animationInterval, int defaultFrameIndex, boolean repeatAnimation)
          Creates a new sprite item.
SpriteItem(java.lang.String label, javax.microedition.lcdui.game.Sprite sprite, long animationInterval, int defaultFrameIndex, boolean repeatAnimation, Style style)
          Creates a new sprite item.
 
Method Summary
 boolean animate()
           
protected  int getMinContentHeight()
           
protected  int getMinContentWidth()
           
protected  int getPrefContentHeight(int width)
           
protected  int getPrefContentWidth(int height)
           
protected  void paint(javax.microedition.lcdui.Graphics g, int w, int h)
           
protected  boolean traverse(int direction, int viewportWidth, int viewportHeight, int[] inoutRect)
           
protected  void traverseOut()
           
 
Methods inherited from class javax.microedition.lcdui.CustomItem
getGameAction, getInteractionModes, hideNotify, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Item
addCommand, getLabel, getLayout, getMinimumHeight, getMinimumWidth, getPreferredHeight, getPreferredWidth, notifyStateChanged, removeCommand, setDefaultCommand, setItemCommandListener, setLabel, setLayout, setPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpriteItem

public SpriteItem(java.lang.String label,
                  javax.microedition.lcdui.game.Sprite sprite,
                  long animationInterval,
                  int defaultFrameIndex,
                  boolean repeatAnimation)
Creates a new sprite item.

Parameters:
label - the label of this item
sprite - the sprite that should be painted
animationInterval - the interval in milliseconds for animating this item
defaultFrameIndex - the frame that is shown when the SpriteItem is not focused
repeatAnimation - defines whether the animation should be repeated when the last frame of the frame-sequence has been reached.

SpriteItem

public SpriteItem(java.lang.String label,
                  javax.microedition.lcdui.game.Sprite sprite,
                  long animationInterval,
                  int defaultFrameIndex,
                  boolean repeatAnimation,
                  Style style)
Creates a new sprite item.

Parameters:
label - the label of this item
sprite - the sprite that should be painted
animationInterval - the interval in milliseconds for animating this item
defaultFrameIndex - the frame that is shown when the SpriteItem is not focused
repeatAnimation - defines whether the animation should be repeated when the last frame of the frame-sequence has been reached.
style - the CSS style
Method Detail

getMinContentWidth

protected int getMinContentWidth()
Specified by:
getMinContentWidth in class javax.microedition.lcdui.CustomItem

getMinContentHeight

protected int getMinContentHeight()
Specified by:
getMinContentHeight in class javax.microedition.lcdui.CustomItem

getPrefContentWidth

protected int getPrefContentWidth(int height)
Specified by:
getPrefContentWidth in class javax.microedition.lcdui.CustomItem

getPrefContentHeight

protected int getPrefContentHeight(int width)
Specified by:
getPrefContentHeight in class javax.microedition.lcdui.CustomItem

paint

protected void paint(javax.microedition.lcdui.Graphics g,
                     int w,
                     int h)
Specified by:
paint in class javax.microedition.lcdui.CustomItem

animate

public boolean animate()

traverse

protected boolean traverse(int direction,
                           int viewportWidth,
                           int viewportHeight,
                           int[] inoutRect)
Overrides:
traverse in class javax.microedition.lcdui.CustomItem

traverseOut

protected void traverseOut()
Overrides:
traverseOut in class javax.microedition.lcdui.CustomItem