DirectX Media for Animation Java Reference |
![]() Previous |
![]() Classes |
![]() Index |
![]() Next |
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 ()); } }
public DXMApplet();Creates an DXMApplet object.
public boolean handleEvent(Event e);Overrides the Java implementation and calls the superclass. For more information, see a Java reference.
public void init();Overrides the Java implementation and calls the superclass. For more information, see a Java reference.
public void paint(Graphics g);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);Overrides the Java implementation and calls the superclass. For more information, consult a Java reference book.
public void start();Overrides the Java implementation and calls the superclass. For more information, consult a Java reference book.
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.
public void update(Graphics g);Overrides the Java implementation and calls the superclass. For more information, see a Java reference.
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.
public double getCurrentTickTime();See getCurrentTickTime in the Viewer Interface section.
public double getCurrentTime();See getCurrentTime in the Viewer Interface section.
public Preferences getPreferences();See getPreferences in the Viewer Interface section.
public ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w);See registerErrorAndWarningReceiver in the Viewer Interface section.
public void setPreferences(Preferences p);See setPreferences in the Viewer Interface section.
public void startModel();See startModel in the Viewer Interface section.
public void stopModel();See stopModel in the Viewer Interface section.
public void tick();See tick in the Viewer Interface section.
public synchronized void tick (double timeToUse);See tick in the Viewer Interface section.
public Model getModel();Gets the model that was set by setModel.
public void setModel(Model model);Sets the model that will be used.
Parameter Description 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.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.