Class AnimatedButton


  • @Deprecated
    public class AnimatedButton
    extends Animation
    Deprecated.
    An animated button control.
    This control displays an animated button which can take 'S' different states and each state is fades in or out in 'F' frames. 'S' and 'F' represent the two first constructor arguments. The frames of this special animation have to be ordered to be supported by this class. The states are numbered from 0 to 'S'-1 and the frames order is the following depending on the layoutType value:
     FADE_OUT_LAYOUT    :  S0F0,S0F1,S0F2,S1F0,S1F1,S1F2,S2F0,S2F1,S2F2
    FADE_IN_LAYOUT : S0F2,S0F1,S0F0,S1F2,S1F1,S1F0,S2F2,S2F1,S2F0
    FADE_OUT_IN_LAYOUT : S0F0,S0F1,S1F1,S1F0,S1F1,S2F1,S2F0,S2F1,S0F1
    where S stands for state, F for frame; and where S0F0, S1F0, and S2F0 are the full states and the others are transition frames. Open the onOff.bmp in the Scape game sample and you will understand ;-) .
    • Field Detail

      • FADE_OUT_LAYOUT

        public static final int FADE_OUT_LAYOUT
        Deprecated.
        Defines the frames animation order. In the case of S states button of F frames per state, FADE_OUT_LAYOUT means that the frames are a S set of F frames that are fading out the state, which means the first frame of each set is the full state image. In the FADE_IN_LAYOUT layout, it's the opposite, namely the last frame of each set represents the state ending position. Finally the FADE_OUT_IN_LAYOUT is a mix of the two others, because inter-frames represent successively fading out from one state to fading in to next state.
        See Also:
        Constant Field Values
      • state

        protected int state
        Deprecated.
        current animated button state
      • layoutType

        protected int layoutType
        Deprecated.
      • fadeInState

        protected int fadeInState
        Deprecated.
      • framesPerState

        protected int framesPerState
        Deprecated.
      • maxStates

        protected int maxStates
        Deprecated.
      • statesIndexes

        protected int[] statesIndexes
        Deprecated.
    • Constructor Detail

      • AnimatedButton

        public AnimatedButton​(Image frames,
                              int states,
                              int framesPerState,
                              int layoutType,
                              int framePeriod)
                       throws ImageException
        Deprecated.
        Animated button constructor.
        Parameters:
        frames - Button different states frames in multi-frame BMP format.
        states - Number of states of the button.
        framesPerState - Number of frames for each state.
        layoutType - FADE_OUT_LAYOUT, FADE_IN_LAYOUT, or FADE_OUT_IN_LAYOUT.
        framePeriod - Delay in milliseconds between two frames.
        Throws:
        ImageException - If an internal method throws it.
        See Also:
        FADE_OUT_LAYOUT, FADE_IN_LAYOUT, FADE_OUT_IN_LAYOUT
    • Method Detail

      • setState

        public void setState​(int state)
        Deprecated.
        Sets the animated button state.
        Parameters:
        state - Value between 0 and states-1.
      • getState

        public int getState()
        Deprecated.
        Gets the animated button state.
        Returns:
        Value between 0 and states-1.
      • onEvent

        public void onEvent​(Event event)
        Deprecated.
        Animated button event handler.
        Overrides:
        onEvent in class Animation
        Parameters:
        event - The event being handled.
        See Also:
        Event, KeyEvent, PenEvent
      • inc

        protected void inc​(boolean up)
        Deprecated.
        Increases/decreases the animated button state.
        Parameters:
        up - Boolean with a true value to increase the value; decrease otherwise.