DirectAnimation Animated Header --DXMCanvas Class DirectAnimation Animated Header --DXMCanvas Class* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: DXMApplet Class
*Next Topic: DXMEvent Class

DXMCanvas Class


public class DXMCanvas extends java.awt.Canvas{
    // Constructor
    public DXMCanvas();
    
    // Methods from java.awt.Canvas
    public synchronized void addNotify();
    public synchronized boolean handleEvent(Event e);
    public synchronized void hide();
    public void paint(Graphics g);
    public synchronized void removeNotify();
    public synchronized void reshape(int x, int y, int width, int height);
    public synchronized void show();
    public void update(Graphics g);

    //Methods from Runnable Interface
    public void run();

    // Methods from Viewer Interface
    public double getCurrentTime();
    public double getCurrentTickTime();
    public Preferences getPreferences();
    public ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w);
    public void startModel();
    public void stopModel();
    public void tick();
    public synchronized void tick (double timeToUse);
    
    // Methods
    public synchronized void addModel();
    public synchronized abstract void addModel();
    public Model getModel();
    public synchronized void hideModel();
    public synchronized abstract void hideModel();
    public synchronized void removeModel();
    public synchronized abstract void removeModel();
    public void setModel(Model);
    public synchronized void showModel();
    public synchronized abstract void showModel();
 }

Creates an Java canvas for creating and displaying 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 Constructor

DXMCanvas Class

Creates an DXMCanvas object.

public DXMCanvas( );



DXMCanvas Methods from java.awt.Canvas

bullet1.gifaddNotify

bullet1.gifhandleEvent

bullet1.gifhide

bullet1.gifpaint

bullet1.gifremoveNotify

bullet1.gifreshape

bullet1.gifshow

bullet1.gifupdate


addNotify

DXMCanvas Class

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

public synchronized void addNotify( );


handleEvent

DXMCanvas Class

Overrides the Java implementation and calls the superclass. For more information, see a Java reference.

public synchronized boolean handleEvent(
  Event e
  );


hide

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden. For more information, see a Java reference.

public synchronized void hide( );


paint

DXMCanvas Class

Overrides the Java implementation and calls the superclass. For more information, see a Java reference.

public void paint(
  Graphics g
  );


removeNotify

DXMCanvas Class

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

public synchronized void removeNotify( );


reshape

DXMCanvas Class

Overrides the Java implementation and calls the superclass. For more information, see a Java reference.

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


show

DXMCanvas Class

Overrides the Java implementation and calls the superclass. This method should not be overridden. For more information, see a Java reference.

public synchronized void show( );


update

DXMCanvas Class

Overrides the Java implementation and calls the superclass. For more information, see a Java reference.

public void update(
  Graphics g
  );

Parameters
g
The object to be updated.

DXMCanvas Methods from Runnable Interface

bullet1.gifrun


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.

public void run( );

DXMCanvas Methods from Viewer Interface

getCurrentTime
getCurrentTickTime
getPreferences
registerErrorAndWarningReceiver
startModel
stopModel
tick()
tick(timeToUse)


getCurrentTime

DXMCanvas Class

See getCurrentTime in the Viewer Interface.

public double getCurrentTime( );


getCurrentTickTime

DXMCanvas Class

See getCurrentTickTime in the Viewer Interface.

public void getCurrentTickTime( );


getPreferences

DXMCanvas Class

See getPreferences in the Viewer Interface.

public Preferences getPreferences( );


registerErrorAndWarningReceiver

DXMCanvas Class

See registerErrorAndWarningReceiver in the Viewer Interface section.

public ErrorAndWarningReceiver registerErrorAndWarningReceiver(
  ErrorAndWarningReceiver w
  );


startModel

DXMCanvas Class

See startModel in the Viewer Interface section.

public void startModel( );


stopModel

DXMCanvas Class

See stopModel in the Viewer Interface section.

public void stopModel( );


tick

DXMCanvas Class

See tick in the Viewer Interface section.

public void tick( );


tick

DXMCanvas Class

See tick in the Viewer Interface section.

public synchronized void tick (
  double timeToUse
  );

DXMCanvas Methods

addModel
addModel - abstract method
getModel
hideModel
hideModel - abstract method
removeModel
removeModel - abstract method
setModel
showModel
showModel - abstract method


addModel

DXMCanvas Class

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

public synchronized void addModel( );


addModel

DXMCanvas Class

Implement this to override addModel.

public abstract synchronized void addModel( );


getModel

DXMCanvas Class

Gets the model that was set by setModel.

public Model getModel( );


hideModel

DXMCanvas Class

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

public synchronized void hideModel( );


hideModel

DXMCanvas Class

Implement this to override hideModel.

public synchronized abstract void hideModel( );


removeModel

DXMCanvas Class

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

public synchronized void removeModel( );


removeModel

DXMCanvas Class

Implement this to override removeModel.

public synchronized abstract void removeModel


setModel

DXMCanvas Class

Sets the model that will be used.

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.

public synchronized void showModel( );


showModel

DXMCanvas Class

Implement this to override showModel.

public synchronized abstract void showModel( );

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page