Animation Class

Animation Class

This Package | All Packages

Control
  |
  +--Animation
public class Animation
extends Control

Provides the animation common control. This control plays an .avi animation file in its window. The methods play and stop control the playback of the video, and the FileName property (getFileName and setFileName) allow you to load in new files.

Constructors
Name Description
Animation() Topic under construction.

Methods
Name Description
addOnStart(EventHandler value) Adds an event handler for the OnStart event notification.
addOnStop(EventHandler value) Adds an event handler for the OnStop event notification.
getAutoPlay() Indicates whether the Animation control is configured to start playing as soon as a video clip is opened.
getCentered() Indicates whether the animation will be in the top-left of the animation control's area or whether it will be centered as necessary.
getCreateParams() Retrieves the parameters when the window was created.
getFileName() Retrieves the file name of the animation to be played.
getTransparent() Indicates whether Windows will draw the animation using a transparent background, or the background color specified in the animation clip.
getUseTimer() Indicates whether a Win32 timer instead of a separate thread is used to manage playback of the animation.
onStart(Event e) Fires the OnStart event.
onStop(Event e) Fires the OnStop event.
play() Plays the animation clip from beginning to end.
play(int repeat, int start, int end) Plays the animation clip the specified number of times with the specified start and end frames.
recreateHandle() Override this method to guarantee the file name is restored correctly after re-creation.
removeOnStart(EventHandler value) Removes the specified event handler for the OnStart event.
removeOnStop(EventHandler value) Removes the specified event handler for the OnStop event.
setAutoPlay(boolean value) Indicates whether the animation control should start playing the animation as soon as a video clip is opened.
setCentered(boolean value) Indicates whether the animation will be in the top-left of the animation control's area or centered as necessary.
setFileName(String value) Sets the file name of the animation to be played.
setTransparent(boolean value) Indicates whether Windows draws the animation using a transparent background rather than using the background color specified in the animation clip.
setUseTimer(boolean value) Indicates whether a Win32 timer should be used instead of a separate thread to manage the playback of the animation.
stop() Stops playing the animation.
wndProc(Message m) The control's window procedure (WndProc).

Constructors

Animation.Animation

Syntax
public Animation();
Description

Topic under construction.

Methods

Animation.addOnStart

Syntax
public final void addOnStart( EventHandler value );
Parameters
value
The new event handler to install for this event.
Description

Adds an event handler for the OnStart event notification. This notification is sent out whenever an animation starts playing. Duplicate calls to addOnStart are not filtered out.

Animation.addOnStop

Syntax
public final void addOnStop( EventHandler value );
Parameters
value
The new event handler to install for this event.
Description

Adds an event handler for the OnStop event notification. This notification is sent out whenever an animation stops playing. Duplicate calls to addOnStop are not filtered out.

Animation.getAutoPlay

Syntax
public final boolean getAutoPlay();
Return Value

Returns true if the control is configured to start playing as soon as a clip is opened; otherwise, returns false. If getAutoPlay returns false, the Animation control does not start playing the animation clip until the play method is called.

Description

Indicates whether the Animation control is configured to start playing as soon as a video clip is opened.

Animation.getCentered

Syntax
public final boolean getCentered();
Return Value

Returns true if the animation will be centered as necessary; otherwise, returns false.

Description

Indicates whether the animation will be in the top-left of the animation control's area or whether it will be centered as necessary.

Animation.getCreateParams

Syntax
protected CreateParams getCreateParams();
Return Value

Returns an object with the information needed to create a window for this component.

Description

Retrieves the parameters when the window was created. This method is called when creating a window. Derived classes can override this method to add extra functionality, However you should first call super.getCreateParams() to make sure the control continues to work correctly.

Animation.getFileName

Syntax
public final String getFileName();
Return Value

Returns the file name of the animation to be played.

Description

Retrieves the file name of the animation to be played.

Animation.getTransparent

Syntax
public final boolean getTransparent();
Return Value

Returns true if the color specified in the Animation clip will not be used; otherwise, returns false.

Description

Indicates whether Windows will draw the animation using a transparent background, or the background color specified in the animation clip.

Animation.getUseTimer

Syntax
public final boolean getUseTimer();
Return Value

Returns true if a timer will be used; otherwise, returns false.

Description

Indicates whether a Win32 timer instead of a separate thread is used to manage playback of the animation.

Animation.onStart

Syntax
protected void onStart( Event e );
Parameters
e
The data in the event that is raised.
Description

Fires the OnStart event. Derived classes should just override this method instead of adding a listener for the event. When overriding this method, be sure to call super.onStart(e) to ensure that the original event is still raised.

Animation.onStop

Syntax
protected void onStop( Event e );
Parameters
e
The data in the event that is raised.
Description

Fires the OnStop event. Derived classes should just override this method instead of adding a listener for the event. When overriding this method, be sure to call super.onStart(e) to ensure that the original event is still raised.

Animation.play

Syntax 1
public final void play();
Description

Plays the animation clip from beginning to end.



Syntax 2
public final void play( int repeat, int start, int end );
Parameters
repeat
The number of times to play the animation clip.
start
The frame on which to start playing.
end
The frame on which to stop playing. A value of -1 indicates that the clip should be played until it ends.
Description

Plays the animation clip the specified number of times with the specified start and end frames.

Animation.recreateHandle

Syntax
public void recreateHandle();
Description

Override this method to guarantee the file name is restored correctly after re-creation.

Animation.removeOnStart

Syntax
public final void removeOnStart( EventHandler value );
Parameters
value
The event handler to be removed.
Description

Removes the specified event handler for the OnStart event. If there are duplicate entries, all are removed.

Animation.removeOnStop

Syntax
public final void removeOnStop( EventHandler value );
Parameters
value
The event handler to be removed.
Description

Removes the specified event handler for the OnStop event. If there are duplicate entries, all are removed.

Animation.setAutoPlay

Syntax
public final void setAutoPlay( boolean value );
Parameters
value
Set to true for the animation to automatically begin playing; set to false for the clip to begin playing when the play method is called.
Description

Indicates whether the animation control should start playing the animation as soon as a video clip is opened.

Animation.setCentered

Syntax
public final void setCentered( boolean value );
Parameters
value
The new value for this property. Set to true for the animation to be centered as necessary; set to false for it to be played in the top-left of the animation control area.
Description

Indicates whether the animation will be in the top-left of the animation control's area or centered as necessary.

Animation.setFileName

Syntax
public final void setFileName( String value );
Parameters
value
The name of the file to play. A null value clears the display.
Description

Sets the file name of the animation to be played.

Animation.setTransparent

Syntax
public final void setTransparent( boolean value );
Parameters
value
The new value for this property. Set to true for Windows to use a transparent background; set to false for the background color specified in the animation clip to be used.
Description

Indicates whether Windows draws the animation using a transparent background rather than using the background color specified in the animation clip.

Animation.setUseTimer

Syntax
public final void setUseTimer( boolean value );
Parameters
value
Set to true to use a timer; set to false to use a separate thread to manage animation playback.
Description

Indicates whether a Win32 timer should be used instead of a separate thread to manage the playback of the animation.

Animation.stop

Syntax
public final void stop();
Description

Stops playing the animation.

Animation.wndProc

Syntax
protected void wndProc( Message m );
Parameters
m
The Windows message sent to the control.
Description

The control's window procedure (WndProc). Derived classes can override this method to monitor messages but should be sure to call super.wndProc(m) to ensure correct functionality.