home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / msdev / bin / ide / vjappwiz.awx / TEMPLATE / APPLET.JVA < prev    next >
Encoding:
Text File  |  1996-07-12  |  22.1 KB  |  727 lines

  1. $$IF(Comments)
  2. //******************************************************************************
  3. // $$AppName$$.java:    Applet
  4. //
  5. //******************************************************************************
  6. $$ENDIF
  7. import java.applet.*;
  8. import java.awt.*;
  9. $$IF(StandAlone)
  10. import $$AppName$$Frame;
  11. $$ENDIF(StandAlone)
  12.  
  13. $$IF(Comments)
  14. //==============================================================================
  15. // Main Class for applet $$AppName$$
  16. //
  17. //==============================================================================
  18. $$ENDIF
  19. $$IF(IsRunnable)
  20. public class $$AppName$$ extends Applet implements Runnable
  21. $$ELSE
  22. public class $$AppName$$ extends Applet
  23. $$ENDIF
  24. {
  25. $$IF(IsRunnable)
  26. $$IF(Comments)
  27.     // THREAD SUPPORT:
  28.     //        m_$$AppName$$    is the Thread object for the applet
  29.     //--------------------------------------------------------------------------
  30. $$ENDIF
  31.     Thread     m_$$AppName$$ = null;
  32.  
  33. $$IF(Animation)
  34. $$IF(Comments)
  35.     // ANIMATION SUPPORT:
  36.     //        m_Graphics        used for storing the applet's Graphics context
  37.     //        m_Images[]        the array of Image objects for the animation
  38.     //        m_nCurrImage    the index of the next image to be displayed
  39.     //        m_ImgWidth        width of each image
  40.     //        m_ImgHeight        height of each image
  41.     //        m_fAllLoaded    indicates whether all images have been loaded
  42.     //        NUM_IMAGES         number of images used in the animation
  43.     //--------------------------------------------------------------------------
  44. $$ENDIF
  45.     private Graphics m_Graphics;
  46.     private Image     m_Images[];
  47.     private int      m_nCurrImage;
  48.     private int      m_nImgWidth  = 0;
  49.     private int      m_nImgHeight = 0;
  50.     private boolean  m_fAllLoaded = false;
  51.     private final int NUM_IMAGES = 18;
  52.  
  53. $$ENDIF(Animation)
  54. $$ENDIF(IsRunnable)
  55. $$IF(StandAlone)
  56.     // STANDALONE APPLICATION SUPPORT:
  57.     //        m_fStandAlone will be set to true if applet is run standalone
  58.     //--------------------------------------------------------------------------
  59.     boolean m_fStandAlone = false;
  60.  
  61. $$ENDIF
  62. $$IF(HasParameters)
  63. $$IF(Comments)
  64.     // PARAMETER SUPPORT:
  65.     //        Parameters allow an HTML author to pass information to the applet;
  66.     // the HTML author specifies them using the <PARAM> tag within the <APPLET>
  67.     // tag.  The following variables are used to store the values of the
  68.     // parameters.
  69.     //--------------------------------------------------------------------------
  70.  
  71.     // Members for applet parameters
  72.     // <type>       <MemberVar>    = <Default Value>
  73.     //--------------------------------------------------------------------------
  74. $$ENDIF
  75. $$BEGINLOOP(Parameters)
  76. $$IF(HasMember)
  77.     private $$ParamType$$ $$ParamMemberName$$ = $$ParamDefValue$$;
  78. $$ENDIF
  79. $$ENDLOOP
  80.  
  81.     // Parameter names.  To change a name of a parameter, you need only make
  82.     // a single change.  Simply modify the value of the parameter string below.
  83.     //--------------------------------------------------------------------------
  84. $$BEGINLOOP(Parameters)
  85.     private final String PARAM_$$ParamName$$ = "$$ParamName$$";
  86. $$ENDLOOP
  87. $$IF(StandAlone)
  88.  
  89. $$IF(Comments)
  90.     // STANDALONE APPLICATION SUPPORT
  91.     //     The GetParameter() method is a replacement for the getParameter() method
  92.     // defined by Applet. This method returns the value of the specified parameter;
  93.     // unlike the original getParameter() method, this method works when the applet
  94.     // is run as a standalone application, as well as when run within an HTML page.
  95.     // This method is called by GetParameters().
  96.     //---------------------------------------------------------------------------
  97. $$ENDIF(Comments)
  98.     String GetParameter(String strName, String args[])
  99.     {
  100.         if (args == null)
  101.         {
  102. $$IF(Comments)
  103.             // Running within an HTML page, so call original getParameter().
  104.             //-------------------------------------------------------------------
  105. $$ENDIF(Comments)
  106.             return getParameter(strName);
  107.         }
  108.  
  109. $$IF(Comments)
  110.         // Running as standalone application, so parameter values are obtained from
  111.         // the command line. The user specifies them as follows:
  112.         //
  113.         //    JView $$AppName$$ param1=<val> param2=<"val with spaces"> ...
  114.         //-----------------------------------------------------------------------
  115. $$ENDIF(Comments)
  116.         int    i;
  117.         String strArg    = strName + "=";
  118.         String strValue = null;
  119.  
  120.         for (i = 0; i < args.length; i++)
  121.         {
  122.             if (strArg.equalsIgnoreCase(args[i].substring(0, strArg.length())))
  123.             {
  124.                 // Found matching parameter on command line, so extract its value.
  125.                 // If in double quotes, remove the quotes.
  126.                 //---------------------------------------------------------------
  127.                 strValue= args[i].substring(strArg.length());
  128.                 if (strValue.startsWith("\""))
  129.                 {
  130.                     strValue = strValue.substring(1);
  131.                     if (strValue.endsWith("\""))
  132.                         strValue = strValue.substring(0, strValue.length() - 1);
  133.                 }
  134.             }
  135.         }
  136.  
  137.         return strValue;
  138.     }
  139.  
  140. $$IF(Comments)
  141.     // STANDALONE APPLICATION SUPPORT
  142.     //     The GetParameters() method retrieves the values of each of the applet's
  143.     // parameters and stores them in variables. This method works both when the
  144.     // applet is run as a standalone application and when it's run within an HTML
  145.     // page.  When the applet is run as a standalone application, this method is
  146.     // called by the main() method, which passes it the command-line arguments.
  147.     // When the applet is run within an HTML page, this method is called by the
  148.     // init() method with args == null.
  149.     //---------------------------------------------------------------------------
  150. $$ENDIF(Comments)
  151.     void GetParameters(String args[])
  152.     {
  153. $$IF(Comments)
  154.         // Query values of all Parameters
  155.         //--------------------------------------------------------------
  156. $$ENDIF
  157.         String param;
  158.  
  159. $$BEGINLOOP(Parameters)
  160. $$IF(Comments)
  161.         // $$ParamName$$: $$ParamDescription$$
  162.         //--------------------------------------------------------------
  163. $$ENDIF
  164.         param = GetParameter(PARAM_$$ParamName$$, args);
  165.         if (param != null)
  166. $$IF(HasMember)
  167.             $$ParamMemberName$$ = $$ParamFromString$$;
  168. $$ELSE
  169. $$IF(TODOComments)
  170.             // TODO: Process parameter $$ParamName$$
  171. $$ENDIF
  172.             ;
  173.         else
  174. $$IF(TODOComments)
  175.             // TODO: Handle case of parameter not provided
  176. $$ENDIF
  177.             ;                
  178. $$ENDIF(HasMember)
  179.  
  180. $$ENDLOOP()
  181.     }
  182.  
  183. $$ENDIF(StandAlone)
  184. $$ENDIF(HasParameters)
  185. $$IF(StandAlone)
  186. $$IF(Comments)
  187.     // STANDALONE APPLICATION SUPPORT
  188.     //     The main() method acts as the applet's entry point when it is run
  189.     // as a standalone application. It is ignored if the applet is run from
  190.     // within an HTML page.
  191.     //--------------------------------------------------------------------------
  192. $$ENDIF
  193.     public static void main(String args[])
  194.     {
  195. $$IF(Comments)
  196.         // Create Toplevel Window to contain applet $$AppName$$
  197.         //----------------------------------------------------------------------
  198. $$ENDIF
  199.         $$AppName$$Frame frame = new $$AppName$$Frame("$$AppName$$");
  200.  
  201.         // Must show Frame before we size it so insets() will return valid values
  202.         //----------------------------------------------------------------------
  203.         frame.show();
  204.         frame.hide();
  205.         frame.resize(frame.insets().left + frame.insets().right  + $$InitialWidth$$,
  206.                      frame.insets().top  + frame.insets().bottom + $$InitialHeight$$);
  207.  
  208. $$IF(Comments)
  209.         // The following code starts the applet running within the frame window.
  210.         // It also calls GetParameters() to retrieve parameter values from the
  211.         // command line, and sets m_fStandAlone to true to prevent init() from
  212.         // trying to get them from the HTML page.
  213.         //----------------------------------------------------------------------
  214. $$ENDIF
  215.         $$AppName$$ applet_$$AppName$$ = new $$AppName$$();
  216.  
  217.         frame.add("Center", applet_$$AppName$$);
  218.         applet_$$AppName$$.m_fStandAlone = true;
  219. $$IF(HasParameters)
  220.         applet_$$AppName$$.GetParameters(args);
  221. $$ENDIF
  222.         applet_$$AppName$$.init();
  223.         applet_$$AppName$$.start();
  224.         frame.show();
  225.     }
  226. $$ENDIF(StandAlone)
  227.  
  228. $$IF(Comments)
  229.     // $$AppName$$ Class Constructor
  230.     //--------------------------------------------------------------------------
  231. $$ENDIF
  232.     public $$AppName$$()
  233.     {
  234. $$IF(TODOComments)
  235.         // TODO: Add constructor code here
  236. $$ENDIF
  237.     }
  238.  
  239. $$IF(Comments)
  240.     // APPLET INFO SUPPORT:
  241.     //        The getAppletInfo() method returns a string describing the applet's
  242.     // author, copyright date, or miscellaneous information.
  243.     //--------------------------------------------------------------------------
  244. $$ENDIF
  245.     public String getAppletInfo()
  246.     {
  247. $$BEGINLOOP(AppInfoLines)
  248.         $$AppInfoLine$$
  249. $$ENDLOOP
  250.     }
  251.  
  252. $$IF(HasParameters)
  253. $$IF(Comments)
  254.     // PARAMETER SUPPORT
  255.     //        The getParameterInfo() method returns an array of strings describing
  256.     // the parameters understood by this applet.
  257.     //
  258.     // $$AppName$$ Parameter Information:
  259.     //  { "Name", "Type", "Description" },
  260.     //--------------------------------------------------------------------------
  261. $$ENDIF
  262.     public String[][] getParameterInfo()
  263.     {
  264.         String[][] info =
  265.         {
  266. $$BEGINLOOP(Parameters)
  267.             { PARAM_$$ParamName$$, "$$ParamType$$", "$$ParamDescription$$" },
  268. $$ENDLOOP
  269.         };
  270.         return info;        
  271.     }
  272. $$ENDIF(Parameters)
  273.  
  274. $$IF(Comments)
  275.     // The init() method is called by the AWT when an applet is first loaded or
  276.     // reloaded.  Override this method to perform whatever initialization your
  277.     // applet needs, such as initializing data structures, loading images or
  278.     // fonts, creating frame windows, setting the layout manager, or adding UI
  279.     // components.
  280.     //--------------------------------------------------------------------------
  281. $$ENDIF
  282.     public void init()
  283.     {
  284. $$IF(HasParameters)
  285. $$IF(StandAlone)
  286.         if (!m_fStandAlone)
  287.             GetParameters(null);
  288. $$ELSE
  289. $$IF(Comments)
  290.         // PARAMETER SUPPORT
  291.         //        The following code retrieves the value of each parameter
  292.         // specified with the <PARAM> tag and stores it in a member
  293.         // variable.
  294.         //----------------------------------------------------------------------
  295. $$ENDIF
  296.         String param;
  297.  
  298. $$BEGINLOOP(Parameters)
  299. $$IF(Comments)
  300.         // $$ParamName$$: $$ParamDescription$$
  301.         //----------------------------------------------------------------------
  302. $$ENDIF
  303.         param = getParameter(PARAM_$$ParamName$$);
  304.         if (param != null)
  305. $$IF(HasMember)
  306.             $$ParamMemberName$$ = $$ParamFromString$$;
  307. $$ELSE
  308. $$IF(TODOComments)
  309.             // TODO: Process parameter $$ParamName$$
  310. $$ENDIF
  311.             ;
  312.         else
  313. $$IF(TODOComments)
  314.             // TODO: Handle case of parameter not provided
  315. $$ENDIF
  316.             ;
  317. $$ENDIF(HasMember)
  318.  
  319. $$ENDLOOP()
  320. $$ENDIF(StandAlone)
  321. $$ENDIF(HasParameters)
  322.         // If you use a ResourceWizard-generated "control creator" class to
  323.         // arrange controls in your applet, you may want to call its
  324.         // CreateControls() method from within this method. Remove the following
  325.         // call to resize() before adding the call to CreateControls();
  326.         // CreateControls() does its own resizing.
  327.         //----------------------------------------------------------------------
  328.         resize($$InitialWidth$$, $$InitialHeight$$);
  329.  
  330. $$IF(TODOComments)
  331.         // TODO: Place additional initialization code here
  332. $$ENDIF
  333.     }
  334.  
  335. $$IF(Comments)
  336.     // Place additional applet clean up code here.  destroy() is called when
  337.     // when you applet is terminating and being unloaded.
  338.     //-------------------------------------------------------------------------
  339. $$ENDIF
  340.     public void destroy()
  341.     {
  342. $$IF(TODOComments)
  343.         // TODO: Place applet cleanup code here
  344. $$ENDIF
  345.     }
  346.  
  347. $$IF(Animation)
  348. $$IF(Comments)
  349.     // ANIMATION SUPPORT
  350.     //        The imageUpdate() method is called repeatedly by the AWT while
  351.     // images are being constructed.  The flags parameter provides information
  352.     // about the status of images under construction.  The AppletWizard's
  353.     // initial implementation of this method checks whether the ALLBITS flag is
  354.     // set.  When the ALLBITS is set, this method knows that an image is
  355.     // completely loaded. When all the images are completely loaded, this
  356.     // method sets the m_fAllLoaded variable to true so that animation can begin.
  357.     //--------------------------------------------------------------------------
  358. $$ENDIF
  359.     public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
  360.     {
  361. $$IF(Comments)
  362.         // Nothing to do if images are all loaded
  363.         //----------------------------------------------------------------------
  364. $$ENDIF(Comments)
  365.         if (m_fAllLoaded)
  366.             return false;
  367.  
  368. $$IF(Comments)
  369.         // Want all bits to be available before painting
  370.         //----------------------------------------------------------------------
  371. $$ENDIF
  372.         if ((flags & ALLBITS) == 0)
  373.             return true;
  374.  
  375. $$IF(Comments)
  376.         // All bits are available, so increment loaded count of fully
  377.         // loaded images, starting animation if all images are loaded
  378.         //----------------------------------------------------------------------
  379. $$ENDIF
  380.         if (++m_nCurrImage == NUM_IMAGES)
  381.         {
  382.             m_nCurrImage = 0;
  383.             m_fAllLoaded = true;
  384.         }                
  385.  
  386.         return false;
  387.     }
  388.  
  389. $$IF(Comments)
  390.     // ANIMATION SUPPORT:
  391.     //        Draws the next image, if all images are currently loaded
  392.     //--------------------------------------------------------------------------
  393. $$ENDIF 
  394.     private void displayImage(Graphics g)
  395.     {
  396.         if (!m_fAllLoaded)
  397.             return;
  398.  
  399. $$IF(Comments)
  400.         // Draw Image in center of applet
  401.         //----------------------------------------------------------------------
  402. $$ENDIF
  403.         g.drawImage(m_Images[m_nCurrImage], 
  404.                    (size().width - m_nImgWidth)   / 2,
  405.                    (size().height - m_nImgHeight) / 2, null);
  406.     }
  407.  
  408. $$ENDIF(Animation)
  409. $$IF(Comments)
  410.     // $$AppName$$ Paint Handler
  411.     //--------------------------------------------------------------------------
  412. $$ENDIF
  413.     public void paint(Graphics g)
  414.     {
  415. $$IF(Animation)
  416.         // ANIMATION SUPPORT:
  417.         //        The following code displays a status message until all the
  418.         // images are loaded. Then it calls displayImage to display the current
  419.         // image.
  420.         //----------------------------------------------------------------------
  421.         if (m_fAllLoaded)
  422.         {
  423.             Rectangle r = g.getClipRect();
  424.             
  425.             g.clearRect(r.x, r.y, r.width, r.height);
  426.             displayImage(g);
  427.         }
  428.         else
  429.             g.drawString("Loading images...", 10, 20);
  430.  
  431. $$IF(TODOComments)
  432.         // TODO: Place additional applet Paint code here
  433. $$ENDIF
  434. $$ELIF(IsRunnable)
  435. $$IF(TODOComments)
  436.         // TODO: Place applet paint code here
  437. $$ENDIF
  438.         g.drawString("Running: " + Math.random(), 10, 20);
  439. $$ENDIF(Animation)
  440.     }
  441.  
  442. $$IF(Comments)
  443.     //        The start() method is called when the page containing the applet
  444.     // first appears on the screen. The AppletWizard's initial implementation
  445.     // of this method starts execution of the applet's thread.
  446.     //--------------------------------------------------------------------------
  447. $$ENDIF
  448.     public void start()
  449.     {
  450. $$IF(IsRunnable)
  451.         if (m_$$AppName$$ == null)
  452.         {
  453.             m_$$AppName$$ = new Thread(this);
  454.             m_$$AppName$$.start();
  455.         }
  456. $$ENDIF
  457. $$IF(TODOComments)
  458.         // TODO: Place additional applet start code here
  459. $$ENDIF
  460.     }
  461.     
  462. $$IF(Comments)
  463.     //        The stop() method is called when the page containing the applet is
  464.     // no longer on the screen. The AppletWizard's initial implementation of
  465.     // this method stops execution of the applet's thread.
  466.     //--------------------------------------------------------------------------
  467. $$ENDIF
  468.     public void stop()
  469.     {
  470. $$IF(IsRunnable)
  471.         if (m_$$AppName$$ != null)
  472.         {
  473.             m_$$AppName$$.stop();
  474.             m_$$AppName$$ = null;
  475.         }
  476. $$IF(TODOComments)
  477.  
  478.         // TODO: Place additional applet stop code here
  479. $$ENDIF
  480. $$ENDIF(IsRunnable)
  481.     }
  482.  
  483. $$IF(IsRunnable)
  484. $$IF(Comments)
  485.     // THREAD SUPPORT
  486.     //        The run() method is called when the applet's thread is started. If
  487.     // your applet performs any ongoing activities without waiting for user
  488.     // input, the code for implementing that behavior typically goes here. For
  489.     // example, for an applet that performs animation, the run() method controls
  490.     // the display of images.
  491.     //--------------------------------------------------------------------------
  492. $$ENDIF
  493.     public void run()
  494.     {
  495. $$IF(Animation)
  496.         repaint();
  497.  
  498.         m_Graphics = getGraphics();
  499.         m_nCurrImage   = 0;
  500.         m_Images   = new Image[NUM_IMAGES];
  501.  
  502. $$IF(Comments)
  503.         // Load in all the images
  504.         //----------------------------------------------------------------------
  505. $$ENDIF
  506.         String strImage;
  507.  
  508.         // For each image in the animation, this method first constructs a
  509.         // string containing the path to the image file; then it begins loading
  510.         // the image into the m_Images array.  Note that the call to getImage
  511.         // will return before the image is completely loaded.
  512.         //----------------------------------------------------------------------
  513.         for (int i = 1; i <= NUM_IMAGES; i++)
  514.         {
  515. $$IF(Comments)
  516.             // Build path to next image
  517.             //------------------------------------------------------------------
  518. $$ENDIF
  519.             strImage = "images/img00" + ((i < 10) ? "0" : "") + i + ".gif";
  520. $$IF(StandAlone)
  521.             if (m_fStandAlone)
  522.                 m_Images[i-1] = Toolkit.getDefaultToolkit().getImage(strImage);
  523.             else
  524.                 m_Images[i-1] = getImage(getDocumentBase(), strImage);
  525. $$ELSE
  526.             m_Images[i-1] = getImage(getDocumentBase(), strImage);
  527. $$ENDIF
  528. $$IF(Comments)
  529.  
  530.             // Get width and height of one image.
  531.             // Assuming all images are same width and height
  532.             //------------------------------------------------------------------
  533. $$ENDIF
  534.             if (m_nImgWidth == 0)
  535.             {
  536.                 try
  537.                 {
  538.                     // The getWidth() and getHeight() methods of the Image class
  539.                     // return -1 if the dimensions are not yet known. The
  540.                     // following code keeps calling getWidth() and getHeight()
  541.                     // until they return actual values.
  542.                     // NOTE: This is only executed once in this loop, since we
  543.                     //       are assuming all images are the same width and
  544.                     //       height.  However, since we do not want to duplicate
  545.                     //       the above image load code, the code resides in the
  546.                     //       loop.
  547.                     //----------------------------------------------------------
  548.                     while ((m_nImgWidth = m_Images[i-1].getWidth(null)) < 0)
  549.                         Thread.sleep(1);
  550.  
  551.                     while ((m_nImgHeight = m_Images[i-1].getHeight(null)) < 0)
  552.                         Thread.sleep(1);                        
  553.                 }
  554.                 catch (InterruptedException e)
  555.                 {
  556. $$IF(TODOComments)
  557.                     // TODO: Place exception-handling code here in case an
  558.                     //       InterruptedException is thrown by Thread.sleep(),
  559.                     //         meaning that another thread has interrupted this one
  560. $$ENDIF
  561.                 }
  562.             }
  563. $$IF(Comments)
  564.  
  565.             // Force image to fully load
  566.             //------------------------------------------------------------------
  567. $$ENDIF
  568.             m_Graphics.drawImage(m_Images[i-1], -1000, -1000, this);
  569.         }
  570.  
  571. $$IF(Comments)
  572.         // Wait until all images are fully loaded
  573.         //----------------------------------------------------------------------
  574. $$ENDIF
  575.         while (!m_fAllLoaded)
  576.         {
  577.             try
  578.             {
  579.                 Thread.sleep(10);
  580.             }
  581.             catch (InterruptedException e)
  582.             {
  583. $$IF(TODOComments)
  584.                 // TODO: Place exception-handling code here in case an
  585.                 //       InterruptedException is thrown by Thread.sleep(),
  586.                 //         meaning that another thread has interrupted this one
  587. $$ENDIF
  588.             }
  589.         }
  590.         
  591.         repaint();
  592.  
  593. $$ENDIF(Animation)
  594.         while (true)
  595.         {
  596.             try
  597.             {
  598. $$IF(Animation)
  599. $$IF(Comments)
  600.                 // Draw next image in animation
  601.                 //--------------------------------------------------------------
  602. $$ENDIF
  603.                 displayImage(m_Graphics);
  604.                 m_nCurrImage++;
  605.                 if (m_nCurrImage == NUM_IMAGES)
  606.                     m_nCurrImage = 0;
  607.  
  608. $$ELSE
  609.                 repaint();
  610. $$ENDIF(Animation)
  611. $$IF(TODOComments)
  612.                 // TODO:  Add additional thread-specific code here
  613. $$ENDIF
  614.                 Thread.sleep(50);
  615.             }
  616.             catch (InterruptedException e)
  617.             {
  618. $$IF(TODOComments)
  619.                 // TODO: Place exception-handling code here in case an
  620.                 //       InterruptedException is thrown by Thread.sleep(),
  621.                 //         meaning that another thread has interrupted this one
  622. $$ENDIF
  623.                 stop();
  624.             }
  625.         }
  626.     }
  627. $$ENDIF(IsRunnable)
  628.  
  629. $$IF(Mouse)
  630. $$IF(MouseDownUp)
  631. $$IF(Comments)
  632.     // MOUSE SUPPORT:
  633.     //        The mouseDown() method is called if the mouse button is pressed
  634.     // while the mouse cursor is over the applet's portion of the screen.
  635.     //--------------------------------------------------------------------------
  636. $$ENDIF
  637.     public boolean mouseDown(Event evt, int x, int y)
  638.     {
  639. $$IF(TODOComments)
  640.         // TODO: Place applet mouseDown code here
  641. $$ENDIF
  642.         return true;
  643.     }
  644.  
  645. $$IF(Comments)
  646.     // MOUSE SUPPORT:
  647.     //        The mouseUp() method is called if the mouse button is released
  648.     // while the mouse cursor is over the applet's portion of the screen.
  649.     //--------------------------------------------------------------------------
  650. $$ENDIF
  651.     public boolean mouseUp(Event evt, int x, int y)
  652.     {
  653. $$IF(TODOComments)
  654.         // TODO: Place applet mouseUp code here
  655. $$ENDIF
  656.         return true;
  657.     }
  658. $$ENDIF(MouseDownUp)
  659. $$IF(MouseDragMove)
  660.  
  661. $$IF(Comments)
  662.     // MOUSE SUPPORT:
  663.     //        The mouseDrag() method is called if the mouse cursor moves over the
  664.     // applet's portion of the screen while the mouse button is being held down.
  665.     //--------------------------------------------------------------------------
  666. $$ENDIF
  667.     public boolean mouseDrag(Event evt, int x, int y)
  668.     {
  669. $$IF(TODOComments)
  670.         // TODO: Place applet mouseDrag code here
  671. $$ENDIF
  672.         return true;
  673.     }
  674.  
  675. $$IF(Comments)
  676.     // MOUSE SUPPORT:
  677.     //        The mouseMove() method is called if the mouse cursor moves over the
  678.     // applet's portion of the screen and the mouse button isn't being held down.
  679.     //--------------------------------------------------------------------------
  680. $$ENDIF
  681.     public boolean mouseMove(Event evt, int x, int y)
  682.     {
  683. $$IF(TODOComments)
  684.         // TODO: Place applet mouseMove code here
  685. $$ENDIF
  686.         return true;
  687.     }
  688. $$ENDIF(MouseDragMove)
  689. $$IF(MouseEnterExit)
  690.  
  691. $$IF(Comments)
  692.     // MOUSE SUPPORT:
  693.     //        The mouseEnter() method is called if the mouse cursor enters the
  694.     // applet's portion of the screen.
  695.     //--------------------------------------------------------------------------
  696. $$ENDIF
  697.     public boolean mouseEnter(Event evt, int x, int y)
  698.     {
  699. $$IF(TODOComments)
  700.         // TODO: Place applet mouseEnter code here
  701. $$ENDIF
  702.         return true;
  703.     }
  704.  
  705. $$IF(Comments)
  706.     // MOUSE SUPPORT:
  707.     //        The mouseExit() method is called if the mouse cursor leaves the
  708.     // applet's portion of the screen.
  709.      //--------------------------------------------------------------------------
  710. $$ENDIF
  711.     public boolean mouseExit(Event evt, int x, int y)
  712.     {
  713. $$IF(TODOComments)
  714.         // TODO: Place applet mouseExit code here
  715. $$ENDIF
  716.         return true;
  717.     }
  718. $$ENDIF(MouseDragMove)
  719. $$ENDIF(Mouse)
  720.  
  721. $$IF(TODOComments)
  722.  
  723.     // TODO: Place additional applet code here
  724.  
  725. $$ENDIF
  726. }
  727.