001         package com.croftsoft.apps.client;
002         
003         import javax.swing.JApplet;
004         
005         import com.croftsoft.core.lang.lifecycle.*;
006         
007         /*********************************************************************
008         * Applet.
009         *
010         * @version
011         *   $Id: ClientApplet.java,v 1.4 2006/12/09 05:15:29 croft Exp $
012         * @since
013         *   2006-10-30
014         * @author
015         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
016         *********************************************************************/
017         
018         public final class  ClientApplet
019           extends JApplet
020           implements Lifecycle
021         //////////////////////////////////////////////////////////////////////
022         //////////////////////////////////////////////////////////////////////
023         {
024           
025         private static final long  serialVersionUID = 0L;
026         
027         //
028         
029         private static final String  PARAM_BOT_ID = "botid";
030         
031         //
032           
033         private final ClientMain  chatMain;
034         
035         //////////////////////////////////////////////////////////////////////
036         //////////////////////////////////////////////////////////////////////
037           
038         public  ClientApplet ( )
039         //////////////////////////////////////////////////////////////////////
040         {
041           chatMain = new ClientMain ( null );
042         }
043         
044         //////////////////////////////////////////////////////////////////////
045         // overridden applet methods
046         //////////////////////////////////////////////////////////////////////
047         
048         @Override
049         public String  getAppletInfo ( )
050         //////////////////////////////////////////////////////////////////////
051         {
052           return chatMain.getClientConfig ( ).getInfo ( );
053         }
054         
055         @Override
056         public void  init ( )
057         //////////////////////////////////////////////////////////////////////
058         {
059           final ClientConfig  clientConfig = chatMain.getClientConfig ( );
060           
061           clientConfig.setCodeBase ( getCodeBase ( ) );
062           
063           chatMain.setContentPane ( getContentPane ( ) );
064           
065           final String  botId = getParameter ( PARAM_BOT_ID );
066           
067           clientConfig.setBotId ( botId );
068           
069           LifecycleLib.init ( chatMain );
070         }
071         
072         @Override
073         public void  start ( )
074         //////////////////////////////////////////////////////////////////////
075         {
076           LifecycleLib.start ( chatMain );
077         }
078         
079         @Override
080         public void  stop ( )
081         //////////////////////////////////////////////////////////////////////
082         {
083           LifecycleLib.stop ( chatMain );
084         }
085         
086         @Override
087         public void  destroy ( )
088         //////////////////////////////////////////////////////////////////////
089         {
090           LifecycleLib.destroy ( chatMain );
091         }
092         
093         //////////////////////////////////////////////////////////////////////
094         //////////////////////////////////////////////////////////////////////
095         }