001         package com.croftsoft.apps.ajgp.anim;
002         
003         import java.awt.*;
004    
005         import com.croftsoft.core.CroftSoftConstants;
006         import com.croftsoft.core.animation.AnimatedApplet;
007         import com.croftsoft.core.animation.AnimationInit;
008         import com.croftsoft.core.animation.painter.ColorPainter;
009    
010         /*********************************************************************
011         * Animation Example
012         *
013         * @version
014         *   2003-05-08
015         * @since
016         *   2003-05-08
017         * @author
018         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
019         *********************************************************************/
020    
021         public final class  AnimationExample
022           extends AnimatedApplet
023         //////////////////////////////////////////////////////////////////////
024         //////////////////////////////////////////////////////////////////////
025         {
026    
027         private static final String  VERSION
028           = "2003-05-08";
029    
030         private static final String  TITLE
031           = "CroftSoft Animation Example";
032    
033         private static final String  APPLET_INFO
034           = "\n" + TITLE + "\n"
035           + CroftSoftConstants.COPYRIGHT + "\n"
036           + CroftSoftConstants.HOME_PAGE + "\n"
037           + "Version " + VERSION + "\n"
038           + CroftSoftConstants.DEFAULT_LICENSE + "\n";
039    
040         //////////////////////////////////////////////////////////////////////
041         // animation constants
042         //////////////////////////////////////////////////////////////////////
043    
044         private static final Color  BACKGROUND_COLOR = Color.BLACK;
045    
046         private static final int    DELTA_X = 1;
047    
048         private static final int    DELTA_Y = 1;
049    
050         private static final Font   FONT
051           = new Font ( "Arioso", Font.BOLD, 20 );
052    
053         private static final Color  FOREGROUND_COLOR = Color.RED;
054    
055         //////////////////////////////////////////////////////////////////////
056         //////////////////////////////////////////////////////////////////////
057    
058         public static void  main ( String [ ]  args )
059         //////////////////////////////////////////////////////////////////////
060         {
061           launch ( new AnimationExample ( ) );
062         }
063    
064         private static AnimationInit  createAnimationInit ( )
065         //////////////////////////////////////////////////////////////////////
066         {
067           AnimationInit  animationInit = new AnimationInit ( );
068    
069           animationInit.setAppletInfo ( APPLET_INFO );
070    
071           animationInit.setBackgroundColor ( BACKGROUND_COLOR );
072    
073           animationInit.setFont ( FONT );
074    
075           animationInit.setForegroundColor ( FOREGROUND_COLOR );
076    
077           animationInit.setFrameTitle ( TITLE );
078    
079           animationInit.setShutdownConfirmationPrompt ( null );
080    
081           return animationInit;
082         }
083    
084         //////////////////////////////////////////////////////////////////////
085         //////////////////////////////////////////////////////////////////////
086    
087         public  AnimationExample ( )
088         //////////////////////////////////////////////////////////////////////
089         {
090           super ( createAnimationInit ( ) );
091         }
092    
093         //////////////////////////////////////////////////////////////////////
094         // interface Lifecycle methods
095         //////////////////////////////////////////////////////////////////////
096    
097         public void  init ( )
098         //////////////////////////////////////////////////////////////////////
099         {
100           super.init ( );
101    
102           addComponentPainter ( new ColorPainter ( ) );
103    
104           addComponentAnimator (
105             new ExampleAnimator ( TITLE, DELTA_X, DELTA_Y ) );
106         }
107    
108         //////////////////////////////////////////////////////////////////////
109         //////////////////////////////////////////////////////////////////////
110         }