001         package com.croftsoft.core.animation;
002    
003         import java.awt.Graphics2D;
004         import java.util.Date;
005         import javax.swing.JComponent;
006    
007         import com.croftsoft.core.animation.AnimatedApplet;
008    
009         /*********************************************************************
010         * Example AnimatedApplet implementation.
011         *
012         * @version
013         *   2003-03-07
014         * @since
015         *   2003-03-07
016         * @author
017         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
018         *********************************************************************/
019    
020         public final class  TimeApplet
021           extends AnimatedApplet
022         //////////////////////////////////////////////////////////////////////
023         //////////////////////////////////////////////////////////////////////
024         {
025    
026         public static void  main ( String [ ]  args )
027         //////////////////////////////////////////////////////////////////////
028         {
029           launch ( new TimeApplet ( ) );
030         }
031    
032         //////////////////////////////////////////////////////////////////////
033         // interface ComponentAnimator methods
034         //////////////////////////////////////////////////////////////////////
035    
036         public void  update ( JComponent  component )
037         //////////////////////////////////////////////////////////////////////
038         {
039           component.repaint ( );
040         }
041    
042         public void  paint (
043           JComponent  component,
044           Graphics2D  graphics2D )
045         //////////////////////////////////////////////////////////////////////
046         {
047           graphics2D.setColor ( getBackground ( ) );
048    
049           graphics2D.fillRect ( 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE );
050    
051           graphics2D.setColor ( getForeground ( ) );
052    
053           graphics2D.drawString ( new Date ( ).toString ( ), 0, 10 );
054         }
055    
056         //////////////////////////////////////////////////////////////////////
057         //////////////////////////////////////////////////////////////////////
058         }