home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / dxma.exe / DXMA05.cab / samples / da / java / templates / BasicApplet / BasicApplet.java next >
Encoding:
Java Source  |  1997-11-13  |  1.4 KB  |  47 lines

  1. // <Tutorial Section=1.0 Title="Basic Applet">
  2. /**
  3. This applet illustrates the proper steps to construct and initialize
  4. a simple DirectAnimation applet.
  5. <BR>
  6. **/
  7. // </Tutorial>
  8. //
  9.  
  10. // <Tutorial Section=1.1>
  11. import com.ms.dxmedia.*;            // direct animation libraries.
  12.  
  13. // This class extends the DXMApplet class.  The model you set in this class,
  14. // by calling the setModel() method, is the model that will be displayed.
  15. public class BasicApplet extends DXMApplet {
  16.  
  17.   // The start() and stop() methods of DXMApplet restart and stop the
  18.   // DirectX Media animation loop already, so you don't need to implement
  19.   // these methods if you don't have other activities you need to stop and
  20.   // restart.
  21.  
  22.   // Set the model in the init() method.
  23.   public void init() {
  24.  
  25.     // Always call the super classes init first to ensure codeBase is set.
  26.     super.init() ;
  27.  
  28.     // Now set the model.
  29.     setModel(new BasicModel());
  30.   }
  31. }
  32.  
  33. // This class extends the Model class.  The createModel method in this class
  34. // is where you construct your animation.
  35. class BasicModel extends Model {
  36.  
  37.   // Create the animation in the createModel method.  In this example, we'll
  38.   // just display a solid blue image.
  39.   public void createModel(BvrsToRun blist)
  40.   {
  41.     // Set the image that actually gets displayed using setImage()
  42.     setImage(solidColorImage(blue));
  43.   }
  44. }
  45.  
  46. // </Tutorial>
  47.