DXMApplet Class


public class DXMApplet extends java.applet.Applet {
    // Constructor
    public DXMApplet();

    // Methods
    public DXMCanvas getCanvas();
    public Model getModel();
    public Model setModel();
    public start();
    public stop();
}

Creates a Java applet for creating and displaying DirectAnimation behaviors. By default, DXMApplet 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. Here is an example of using the DXMApplet to view a model called MyModel:


import com.ms.dxmedia.*;

//Create an applet called MyApplet
public class MyApplet extends DXMApplet{
   public class MyApplet() {
   // Set the model
  setModel(new MyModel());
  }
}

// Code fragment for MyModel
class MyModel extends Model {
  // The createModel method is where the animation is constructed
  public void createModel(BvrsToRun extraBvrsToRun) {

    //Whatever MyModel does 
      	...
  }
}

Constructor

bullet1.gifDXMApplet();


DXMApplet();

Creates an DXMApplet object.

public DXMApplet( );

Methods

bullet1.gifgetCanvas

bullet1.gifgetModel

bullet1.gifsetModel

bullet1.gifstart

bullet1.gifstop


getCanvas

Gets a DXMCanvas. This method should only be called if you are implementing your own ticking.

public DXMCanvas getCanvas( );

Return Values

Returns the DXMCanvas object.


getModel

Gets the model that was set by setModel.

public Model getModel( );


setModel

Sets the model that will be used.

public void setModel(
  Model model
  );

Parameters
model
The model to be set.
Remarks

This method must be called before the model is started. Calling it after the model has started causes an exception.


start

Adds the canvas.

public start( );


stop

Adds the canvas.

public stop( );

Relevant Methods from the Statics Class

The following methods are defined in the Statics class and are most relevant to objects of type DXMApplet.

public static ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w)

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