![]() |
![]() | ![]() |
![]() |
| |||
|
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
- DXMCanvas Methods from Runnable Interface
- DXMCanvas Methods from Viewer Interface
- DXMCanvas Methods
DXMCanvas Methods from java.awt.Canvas
addNotify Overrides the Java implementation and calls the superclass. handleEvent Overrides the Java implementation and calls the superclass. hide Overrides the Java implementation and calls the superclass. paint Overrides the Java implementation and calls the superclass. removeNotify Overrides the Java implementation and calls the superclass. reshape Overrides the Java implementation and calls the superclass. show Overrides the Java implementation and calls the superclass. update Overrides the Java implementation and calls the superclass. addNotify
DXMCanvas ClassOverrides the Java implementation and calls the superclass. This method should not be overridden.
Syntax
public synchronized void addNotify( );
handleEvent
DXMCanvas ClassOverrides 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 ClassOverrides 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 ClassOverrides 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 ClassOverrides 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 ClassOverrides 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 ClassOverrides 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 ClassOverrides 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
run Implements the Runnable interface to create a background thread for ticking the model. run
DXMCanvas ClassImplements 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 ClassReturns the number of seconds since startModel was invoked.
Syntax
public double getCurrentTime( );
Return Value
Returns a double floating-point number.
getCurrentTickTime
DXMCanvas ClassReturns 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 ClassAllows 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 ClassAllows 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 ClassStarts 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 ClassForces 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 ClassProvides 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 ClassExplicitly 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 ClassCreates 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 ClassImplement this to override addModel.
Syntax
public abstract synchronized void addModel( );DXMCanvas
DXMCanvas ClassCreates a DXMCanvas object.
Syntax
public DXMCanvas( );
getModel
DXMCanvas ClassGets the model that was set by setModel.
Syntax
public Model getModel( );
hideModel
DXMCanvas ClassIn the default implementation, this method pauses the background thread. This method can be overridden.
Syntax
public synchronized void hideModel( );hideModel - abstract method
DXMCanvas ClassImplement this to override hideModel.
Syntax
public synchronized abstract void hideModel( );
removeModel
DXMCanvas ClassThis method terminates the thread and then calls stopModel. This method can be overridden.
Syntax
public synchronized void removeModel( );
removeModel - abstract method
DXMCanvas ClassImplement this to override removeModel.
Syntax
public synchronized abstract void removeModel
setModel
DXMCanvas ClassSets the model that will be used.
Syntax
public void setModel( Model model );
Parameters
- model
- The model to be set.
showModel
DXMCanvas ClassIn 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 ClassImplement this to override showModel.
Syntax
public synchronized abstract void showModel( );
Top of Page
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.