Index Topic Contents | |||
Previous Topic: ModifiableBehavior Class Next Topic: MontageBvr Class |
ModelMakerApplet Class
public abstract ModelMakerApplet extends java.lang.Object { // Constructor public ModelMakerApplet(); // Methods public ImageBvr createBackgroundImage(); public IDABehavior grabBackgroundImageComPtr(); public IDABehavior grabImageComPtr(); public IDABehavior grabSoundComPtr(); public IDAView grabViewComPtr(); public ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w); public synchronized void setModel(Model model); }The ModelMakerApplet class is used for constructing models in Java and using them in windowless controls. It is similar to DXMApplet except that it exposes some COM interfaces and doesn't do any ticking (this is performed by the DirectAnimation control called DAViewer). Here is the basic syntax for using ModelMakerApplet:
public class MyTest extends ModelMakerApplet{ public MyTest() { setModel(new testModel()); } }The grabBackgroundImageComPtr, grabImageComPtr, grabSoundComPtr, and grabViewComPtr methods are used on the HTML page, and can be called either from VBScript or JScript. Here is an example of an HTML page that calls these methods, using VBScript:
<HTML> <HEAD> <TITLE>myTest Windowless Control</TITLE> </HEAD> <body> <DIV ID=LAYOUT STYLE="position:absolute; left:0; top:0; width:600; height:400"> <DIV ID=text STYLE="position:absolute; left:0; top:0; width:450; height:280"> <FONT SIZE=4 FACE="Verdana,Tahoma,Arial"> This is standard HTML arranged using DIV tags and atop it we're going to place our DirectX Animation windowless control. </FONT></DIV> </DIV> <DIV ID=controlDiv> <OBJECT ID="DAViewer" STYLE="position:absolute; left:50; top:10;width:200;height:300" CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D"> </OBJECT> </DIV> </DIV> ' The width and height parameters are placeholders. They need to be there to specify the applet and must be set to 1. <applet code=myTest.class codebase=. width=1 height=1 id=javaApp> </applet> <script language="VBScript"> sub window_onLoad set a = document.javaApp ' Get model components out of the Java applet and give it to the ' control. DAViewer.View = a.grabViewComPtr DAViewer.Image = a.grabImageComPtr DAViewer.BackgroundImage = a.grabBackgroundImageComPtr DAViewer.Sound = a.grabSoundComPtr ' Start the control viewing DAViewer.Start end sub </script> </BODY> </HTML>ModelMakerApplet Class
ModelMakerApplet ConstructorCreates an ModelMakerApplet object.
public ModelMakerApplet( );
ModelMakerApplet Methods
registerErrorAndWarningReceiver
ModelMakerApplet Class
createBackgroundImageThis method is used so that models constructed in Java, intended for windowless controls, will have a background image if they appear in a browser that does not support this feature. The model will then be displayed in its own window, as if it were in a standard DirectAnimation applet. Just as these models need a background image to be explicitly inserted, so do windowless applets if they are to degrade gracefully to a windowed display.
public ImageBvr createBackgroundImage( );
Return Values
Returns the ImageBvr object.
Remarks
This method should be called within ModelMakerApplet and not during the createModel implementation. Here is an example:
public class myTest extends ModelMakerApplet { public ImageBvr createBackgroundImage() { return Statics.solidColorImage(Statics.black); } setModel(new testModel()); }ModelMakerApplet Class
grabBackgroundImageComPtrRetrieves the background image component of the model. This method is called from a script on the HTML page.
public IDABehavior grabBackgroundImageComPtr( );
Return Values
Returns the COM pointer to the IDABehavior interface (rather than an ImageBvr.)
ModelMakerApplet Class
grabImageComPtrRetrieves the image component of the model. This method is called from a script on the HTML page.
public IDABehavior grabImageComPtr( );
Return Values
Returns the COM pointer to the IDABehavior interface (rather than an ImageBvr.)
ModelMakerApplet Class
grabSoundComPtrRetrieves the sound component of the model. This method is called from a script on the HTML page.
public IDABehavior grabSoundComPtr( );
Return Values
Returns the COM pointer to the IDABehavior interface (rather than a SoundBvr.)
ModelMakerApplet Class
grabViewComPtrReturns the viewer component of the model. This method is called from a script on the HTML page.
public IDAView grabViewComPtr( );
Return Values
Returns the COM pointer to the IDABehavior interface (rather than a Viewer.)
ModelMakerApplet Class
registerErrorAndWarningReceiverAllows 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.
public ErrorAndWarningReceiver registerErrorAndWarningReceiver(
ErrorAndWarningReceiver w
);Parameters
- w
- The ErrorAndWarningReceiver object to be registered.
Return Values
Returns the ErrorAndWarningReceiver object.
ModelMakerApplet Class
setModelSets the model that will be used.
public synchronized 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.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.