DXMCanvas Class

Creates a Java canvas for creating and displaying Microsoft® DirectAnimation® behaviors. By default, DXMCanvas provides its own frameloop which means the applications need not provide one explicitly. It is possible, of course, to do so by overriding the default behavior.


DXMCanvas Methods from java.awt.Canvas

addNotifyOverrides the Java implementation and calls the superclass.
handleEventOverrides the Java implementation and calls the superclass.
hideOverrides the Java implementation and calls the superclass.
paintOverrides the Java implementation and calls the superclass.
removeNotifyOverrides the Java implementation and calls the superclass.
reshapeOverrides the Java implementation and calls the superclass.
showOverrides the Java implementation and calls the superclass.
updateOverrides the Java implementation and calls the superclass.

addNotify

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden.

Syntax

public synchronized void addNotify( );

handleEvent

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method is called when any event occurs inside the DXMCanvas object.

Syntax

public synchronized boolean handleEvent( Event e );

Parameters

e
The event that occurred.

Return Value

Returns true if the event has been handled and no further action is necessary. Returns false if the event is to be given to the component's parent.

hide

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden. Hides the DXMCanvas object. The object continues to exist and be in its containing object, but it is not visible and does not have any space allocated for it.

Syntax

public synchronized void hide( );

paint

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method is called to repaint this canvas.

Syntax

public void paint( Graphics g );

Parameters

g
The graphics context.

removeNotify

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden. Called when the DXMCanvas object is removed.

Syntax

public synchronized void removeNotify( );

reshape

DXMCanvas Class

Overrides the Java implementation and calls the superclass. Reshapes this component to the specified bounding box in its parent's coordinate space.

Syntax

public synchronized void reshape( int x, int y, int width, int height );

Parameters

x, y
The x- and y-coordinates.
width, height
The width and height of the DXMCanvas object.

show

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden. Shows the DXMCanvas object. If the object has been made invisible by a call to the hide method, makes the object visible again.

Syntax

public synchronized void show( );

update

DXMCanvas Class

Overrides the Java implementation and calls the superclass. Called in response to a call to repaint.

Syntax

public void update( Graphics g );

Parameters

g
The object to be updated.

DXMCanvas Methods from Runnable Interface

runImplements the Runnable interface to create a background thread for ticking the model.

run

DXMCanvas Class

Implements the Runnable interface to create a background thread for ticking the model. For more information about Runnable, consult a Java reference.

Syntax

public void run( );


DXMCanvas Methods from Viewer Interface

getCurrentTime Returns the number of seconds since startModel was invoked.
getCurrentTickTime Returns the time provided for the most recent call to tick or 0 if tick has not yet been called.
getPreferences Allows the application to dynamically view the viewer preferences.
registerErrorAndWarningReceiver Allows the application to register an object that will have its methods invoked when errors are encountered.
startModel Starts the behaviors associated with the model at global time 0.
stopModel Forces all media to stop immediately.
tick() Provides a shorthand way of writing tick(getCurrentTime()).
tick(timeToUse) Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

getCurrentTime

DXMCanvas Class

Returns the number of seconds since startModel was invoked.

Syntax

public double getCurrentTime( );

Return Value

Returns a double floating-point number.

getCurrentTickTime

DXMCanvas Class

Returns the time provided for the most recent call to tick or 0 if tick has not yet been called.

Syntax

public void getCurrentTickTime( );

Return Value

Returns the double floating-point number representing the current tick time.

getPreferences

DXMCanvas Class

Allows the application to dynamically view the viewer preferences. For more information about preferences, see Preferences.

Syntax

public Preferences getPreferences( );

Return Value

Returns the Preferences object.

registerErrorAndWarningReceiver

DXMCanvas Class

Allows the application to register an object that will have its methods invoked upon asynchronous errors encountered when DirectAnimation media is controlling the frame loop or when recoverable errors occur when sampling and displaying the model.

Syntax

public ErrorAndWarningReceiver registerErrorAndWarningReceiver ( ErrorAndWarningReceiver w );

Parameters

w
ErrorAndWarningReceiver object to be registered.

Return Value

Returns the ErrorAndWarningReceiver object.

startModel

DXMCanvas Class

Starts the behaviors associated with the model at global time 0. Also causes the createModel method on the model itself to be invoked.

Syntax

public void startModel( );

stopModel

DXMCanvas Class

Forces all media to stop immediately. It is not required to call this method, however, without it, some media (such as sounds) will continue playing until the object is released.

Syntax

public void stopModel( );

tick()

DXMCanvas Class

Provides a shorthand way of writing tick(getCurrentTime()). It is the easiest way to explicitly sample and display model and provides a real-time clock for global time.

Syntax

public void tick( );

tick(timeToUse)

DXMCanvas Class

Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

Syntax

public synchronized void tick ( double timeToUse );

Parameters

timeToUse
Global time for the single sampling.

DXMCanvas Methods

addModel Creates a background thread to tick the model and calls startModel.
addModel - abstract method Implement this to override addModel.
DXMCanvas Creates a DXMCanvas object.
getModel Gets the model that was set by setModel.
hideModel In the default implementation, pauses the background thread.
hideModel - abstract method Implement this to override hideModel.
removeModel Terminates the thread and then calls stopModel.
removeModel - abstract method Implement this to override removeModel.
setModel Sets the model that will be used.
showModel In the default implementation, ensures that the thread is resumed.
showModel - abstract method Implement this to override showModel.

addModel

DXMCanvas Class

Creates a background thread to tick the model and calls startModel. To perform manual ticking, override this method.

Syntax

public synchronized void addModel( );

addModel - abstract method

DXMCanvas Class

Implement this to override addModel.

Syntax

public abstract synchronized void addModel( );

DXMCanvas

DXMCanvas Class

Creates a DXMCanvas object.

Syntax

public DXMCanvas( );

getModel

DXMCanvas Class

Gets the model that was set by setModel.

Syntax

public Model getModel( );

hideModel

DXMCanvas Class

In the default implementation, this method pauses the background thread. This method can be overridden.

Syntax

public synchronized void hideModel( );

hideModel - abstract method

DXMCanvas Class

Implement this to override hideModel.

Syntax

public synchronized abstract void hideModel( );

removeModel

DXMCanvas Class

This method terminates the thread and then calls stopModel. This method can be overridden.

Syntax

public synchronized void removeModel( );

removeModel - abstract method

DXMCanvas Class

Implement this to override removeModel.

Syntax

public synchronized abstract void removeModel

setModel

DXMCanvas Class

Sets the model that will be used.

Syntax

public void setModel( Model model );

Parameters

model
The model to be set.

showModel

DXMCanvas Class

In the default implementation, this method ensures that the thread is resumed. This method can be overridden.

Syntax

public synchronized void showModel( );

showModel - abstract method

DXMCanvas Class

Implement this to override showModel.

Syntax

public synchronized abstract void showModel( );


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.