DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

DXMApplet Class

Constructor , Methods from java.applet.Applet , Methods from Runnable Interface , Methods from Viewer Interface , Methods

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

    // Methods from java.applet.Applet
    public boolean handleEvent(Event event);
    public void init();
    public void paint(Graphics g);
    public synchronized void reshape(int x, int y, int width, int height);  
    public void start();
    public void stop();
    public void update(Graphics g);

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

    // Methods from Viewer Interface
    public double getCurrentTickTime();
    public double getCurrentTime();
    public Preferences getPreferences();
    public ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w);
    public void setPreferences(Preferences p);
    public void startModel();
    public void stopModel();
    public void tick();
    public synchronized void tick (double timeToUse);

    //Methods
    public Model getModel();
    public void setModel(Model model);
    
 }

Creates an Java applet for creating and displaying Direct Animation 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:

//Code fragment for MyModel
class MyModel extends Model {
	public void createModel(double startTime, BehaviorCtx ctx) {

	//Whatever MyModel does 
      	...
	}
}

//Create an applet called MyApplet
public class MyApplet extends DXMApplet {
      public void init() {
      // Always call the superclass's init() first to ensure codeBase is set
      super.init();
      // Now set the model
      setModel(new MyModel ());
	}
}


Constructor


DXMApplet();

public DXMApplet();

Creates an DXMApplet object.


Methods from java.applet.Applet


handleEvent

public boolean handleEvent(Event e);

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


init

public void init();

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


paint

public void paint(Graphics g);

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


reshape

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

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


start

public void start();

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


stop

public void stop();

Overrides the Java implementation and calls the superclass. For more information, consult a Java reference book. This method can be overridden and replaced.


update

public void update(Graphics g);

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


Methods from Runnable Interface


run

public void run();

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


Methods from Viewer Interface


getCurrentTickTime

public double getCurrentTickTime();

See getCurrentTickTime in the Viewer Interface section.


getCurrentTime

public double getCurrentTime();

See getCurrentTime in the Viewer Interface section.


getPreferences

public Preferences getPreferences();

See getPreferences in the Viewer Interface section.


registerErrorAndWarningReceiver

public ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w);

See registerErrorAndWarningReceiver in the Viewer Interface section.


setPreferences

public void setPreferences(Preferences p);

See setPreferences in the Viewer Interface section.


startModel

public void startModel();

See startModel in the Viewer Interface section.


stopModel

public void stopModel();

See stopModel in the Viewer Interface section.


tick

public void tick();

See tick in the Viewer Interface section.


tick

public synchronized void tick (double timeToUse);

See tick in the Viewer Interface section.


Methods


getModel

public Model getModel();

Gets the model that was set by setModel.


setModel

public void setModel(Model model);

Sets the model that will be used.

ParameterDescription
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.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.